Skip to content

Update plotting code for ggplot2 deprecations#37

Open
foertsch wants to merge 1 commit intopowellgenomicslab:masterfrom
foertsch:fix-ggplot2-deprecations
Open

Update plotting code for ggplot2 deprecations#37
foertsch wants to merge 1 commit intopowellgenomicslab:masterfrom
foertsch:fix-ggplot2-deprecations

Conversation

@foertsch
Copy link

@foertsch foertsch commented Mar 23, 2026

Fixes #27

This PR updates plot_density_() to avoid current ggplot2 deprecation warnings.

Summary

  • replace aes_string() with tidy-eval aes(...) using .data
  • replace element_line(size = ...) with element_line(linewidth = ...)
  • update the roxygen import accordingly

Why

While checking plot_density() on current master, the plotting path worked correctly but emitted ggplot2 deprecation warnings for:

  • aes_string()
  • element_line(size = ...)

This patch keeps behavior the same while making the plotting code compatible with current ggplot2 expectations.

Verification

Tested locally with:

library(Nebulosa)
data <- SeuratObject::pbmc_small
p <- plot_density(data, "CD3E")
inherits(p, "ggplot")

and:

testthat::test_file("tests/testthat/test-plot_density.R")

The direct call still returns a ggplot, and test-plot_density.R now passes without warnings.

Note: I originally looked at issue #22, but current master already appears to handle that Seurat-related failure. While verifying it, I noticed these ggplot2 deprecation warnings and prepared this small cleanup PR instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can you make it compatible to ggplot2v3.5?

1 participant