Skip to content

plot_locus fails due to deprecated ggplot2 syntax (aes_string(), size aesthetic) #154

Description

@bingxunli

I'm using R 4.5.1 with the latest version of ggplot2. The function plot_locus from the echoplot package fails because it relies on ggplot2 features that are now deprecated/defunct.

The specific errors/warnings I see:

  • Error: invalid non-character version specification 'x' (type: double)
  • aes_string() was deprecated in ggplot2 3.0.0.
  • Using size aesthetic for lines was deprecated in ggplot2 3.4.0.

It seems the package needs to update to use aes() with tidy evaluation instead of aes_string(), and use linewidth instead of size for lines.

dat <- echodata::BST1
LD_matrix <- echodata::BST1_LD_matrix
locus_dir <- file.path(tempdir(), echodata::locus_dir)
plt <- tryCatch(

  • echoplot::plot_locus(
    
  •     dat = dat,
    
  •     locus_dir = locus_dir,
    
  •     LD_matrix = LD_matrix,
    
  •     show_plot = FALSE,
    
  •     save_plot = FALSE,
    
  •     verbose = FALSE
    
  • ),
    
  • error = function(e) { message("plot_locus error: ", e$message); NULL }
    
  • )
  • support_thresh = 2
  • Calculating mean Posterior Probability (mean.PP)...
  • 4 fine-mapping methods used.
  • 7 Credible Set SNPs identified.
  • 3 Consensus SNPs identified.
  • Filling NAs in CS cols with 0.
  • Filling NAs in PP cols with 0.
    plot_locus error: The facets argument of facet_grid() was deprecated in ggplot2 2.2.0 and is now defunct.Please use the rows argument instead.
    warning:
    1: aes_string() was deprecated in ggplot2 3.0.0.
    ℹ Please use tidy evaluation idioms with aes().
    ℹ See also vignette("ggplot2-in-packages") for more information.
    ℹ The deprecated feature was likely used in the echoplot package.
    Please report the issue at https://github.com/RajLabMSSM/echoplot/issues.
    This warning is displayed once per session.
    Call lifecycle::last_lifecycle_warnings() to see where this warning was generated.
    2: Using size aesthetic for lines was deprecated in ggplot2 3.4.0.
    ℹ Please use linewidth instead.
    ℹ The deprecated feature was likely used in the echoplot package.
    Please report the issue at https://github.com/RajLabMSSM/echoplot/issues.
    This warning is displayed once per session.
    Call lifecycle::last_lifecycle_warnings() to see where this warning was generated.

lifecycle::last_lifecycle_warnings()
[[1]]
<warning/lifecycle_warning_deprecated>
Warning:
aes_string() was deprecated in ggplot2 3.0.0.
ℹ Please use tidy evaluation idioms with aes().
ℹ See also vignette("ggplot2-in-packages") for more information.
ℹ The deprecated feature was likely used in the echoplot package.
Please report the issue at https://github.com/RajLabMSSM/echoplot/issues.


I think this is because package uses deprecated ggplot2 syntax (aes_string() and the size aesthetic for lines), which causes errors in recent R/ggplot2 versions. Please update to aes() + .data[[ ]] and linewidth
Could you please update the package to be compatible with recent ggplot2 versions? Thank you for your work on this package!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions