-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bulk_clones plot "CNV state" legend colors #182
Comments
Upgrading from ggplot2 3.4.x -> 3.5.0 caused this .. I raised an issue on their github repo. hopefully they fix it soon. |
Thanks for the update! I had some other packages break with ggplot2 3.5.0 as well. |
Hi, I just stumbled across this by accident. |
Curiously, I've seen some packages add specific workarounds related to ggplot2 3.5, so it's definitely a widespread issue without a simple elegant fix. For example, hrbrthemes (with over 1k GitHub stars): https://github.com/hrbrmstr/hrbrthemes/blob/6417996c2931b3fa84102b5034a42a920c91fdb9/R/color.r#L20-L23 |
The code you linked to is to silence soft-deprecation warnings, which is unrelated to legend keys. The way to restore old behaviour is to use |
As an illustration of the fix proposed by @teunbrand and as a possible workaround one can manually set library(numbat)
#> Loading required package: Matrix
library(dplyr, warn=FALSE)
nb <- readRDS(url("http://pklab.med.harvard.edu/teng/data/nb_TNBC1.rds"))
p <- nb$bulk_clones %>%
filter(n_cells > 50) %>%
plot_bulks(
min_LLR = 10, # filtering CNVs by evidence
legend = TRUE
)
for (i in seq_along(p)) {
p[[i]]$layers[[2]]$show.legend <- TRUE
}
p Created on 2024-09-08 with reprex v2.1.1 Session infosessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#> setting value
#> version R version 4.4.1 (2024-06-14)
#> os macOS Sonoma 14.6.1
#> system aarch64, darwin20
#> ui X11
#> language (EN)
#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz Europe/Berlin
#> date 2024-09-08
#> pandoc 3.1.11 @ /Applications/RStudio.app/Contents/Resources/app/quarto/bin/tools/aarch64/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────
#> package * version date (UTC) lib source
#> ape 5.8 2024-04-11 [1] CRAN (R 4.4.0)
#> aplot 0.2.3 2024-06-17 [1] CRAN (R 4.4.0)
#> cachem 1.1.0 2024-05-16 [1] CRAN (R 4.4.0)
#> cli 3.6.3 2024-06-21 [1] CRAN (R 4.4.0)
#> codetools 0.2-20 2024-03-31 [1] CRAN (R 4.4.1)
#> colorspace 2.1-1 2024-07-26 [1] CRAN (R 4.4.0)
#> curl 5.2.2 2024-08-26 [1] CRAN (R 4.4.1)
#> data.table 1.15.4 2024-03-30 [1] CRAN (R 4.4.0)
#> digest 0.6.37 2024-08-19 [1] CRAN (R 4.4.1)
#> dplyr * 1.1.4 2023-11-17 [1] CRAN (R 4.4.0)
#> evaluate 0.24.0 2024-06-10 [1] CRAN (R 4.4.0)
#> fansi 1.0.6 2023-12-08 [1] CRAN (R 4.4.0)
#> farver 2.1.2 2024-05-13 [1] CRAN (R 4.4.0)
#> fastmap 1.2.0 2024-05-15 [1] CRAN (R 4.4.0)
#> fastmatch 1.1-4 2023-08-18 [1] CRAN (R 4.4.0)
#> fs 1.6.4 2024-04-25 [1] CRAN (R 4.4.0)
#> generics 0.1.3 2022-07-05 [1] CRAN (R 4.4.0)
#> ggforce 0.4.2 2024-02-19 [1] CRAN (R 4.4.0)
#> ggfun 0.1.5 2024-05-28 [1] CRAN (R 4.4.0)
#> ggplot2 3.5.1 2024-04-23 [1] CRAN (R 4.4.0)
#> ggplotify 0.1.2 2023-08-09 [1] CRAN (R 4.4.0)
#> ggraph 2.2.1 2024-03-07 [1] CRAN (R 4.4.0)
#> ggrepel 0.9.5.9999 2024-09-03 [1] Github (slowkow/ggrepel@0f34805)
#> ggtree 3.12.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
#> glue 1.7.0 2024-01-09 [1] CRAN (R 4.4.0)
#> graphlayouts 1.1.1 2024-03-09 [1] CRAN (R 4.4.0)
#> gridExtra 2.3 2017-09-09 [1] CRAN (R 4.4.0)
#> gridGraphics 0.5-1 2020-12-13 [1] CRAN (R 4.4.0)
#> gtable 0.3.5 2024-04-22 [1] CRAN (R 4.4.0)
#> hahmmr 1.0.0 2023-10-25 [1] CRAN (R 4.4.0)
#> highr 0.11 2024-05-26 [1] CRAN (R 4.4.0)
#> htmltools 0.5.8.1 2024-04-04 [1] CRAN (R 4.4.0)
#> httr2 1.0.2 2024-07-16 [1] CRAN (R 4.4.0)
#> igraph 2.0.3 2024-03-13 [1] CRAN (R 4.4.0)
#> jsonlite 1.8.8 2023-12-04 [1] CRAN (R 4.4.0)
#> knitr 1.48 2024-07-07 [1] CRAN (R 4.4.0)
#> labeling 0.4.3 2023-08-29 [1] CRAN (R 4.4.0)
#> lattice 0.22-6 2024-03-20 [1] CRAN (R 4.4.1)
#> lazyeval 0.2.2 2019-03-15 [1] CRAN (R 4.4.0)
#> lifecycle 1.0.4 2023-11-07 [1] CRAN (R 4.4.0)
#> logger 0.3.0 2024-03-05 [1] CRAN (R 4.4.0)
#> magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.4.0)
#> MASS 7.3-61 2024-06-13 [1] CRAN (R 4.4.0)
#> Matrix * 1.7-0 2024-04-26 [1] CRAN (R 4.4.1)
#> memoise 2.0.1 2021-11-26 [1] CRAN (R 4.4.0)
#> munsell 0.5.1 2024-04-01 [1] CRAN (R 4.4.0)
#> nlme 3.1-166 2024-08-14 [1] CRAN (R 4.4.0)
#> numbat * 1.4.0 2024-02-23 [1] CRAN (R 4.4.0)
#> parallelDist 0.2.6 2022-02-03 [1] CRAN (R 4.4.0)
#> patchwork 1.2.0 2024-01-08 [1] CRAN (R 4.4.0)
#> phangorn 2.11.1 2023-01-23 [1] CRAN (R 4.4.0)
#> pillar 1.9.0 2023-03-22 [1] CRAN (R 4.4.0)
#> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.4.0)
#> polyclip 1.10-7 2024-07-23 [1] CRAN (R 4.4.0)
#> purrr 1.0.2 2023-08-10 [1] CRAN (R 4.4.0)
#> quadprog 1.5-8 2019-11-20 [1] CRAN (R 4.4.0)
#> R6 2.5.1 2021-08-19 [1] CRAN (R 4.4.0)
#> rappdirs 0.3.3 2021-01-31 [1] CRAN (R 4.4.0)
#> Rcpp 1.0.13 2024-07-17 [1] CRAN (R 4.4.0)
#> RcppParallel 5.1.9 2024-08-19 [1] CRAN (R 4.4.1)
#> reprex 2.1.1 2024-07-06 [1] CRAN (R 4.4.0)
#> RhpcBLASctl 0.23-42 2023-02-11 [1] CRAN (R 4.4.0)
#> rlang 1.1.4 2024-06-04 [1] CRAN (R 4.4.0)
#> rmarkdown 2.28 2024-08-17 [1] CRAN (R 4.4.0)
#> rstudioapi 0.16.0 2024-03-24 [1] CRAN (R 4.4.0)
#> scales 1.3.0 2023-11-28 [1] CRAN (R 4.4.0)
#> scistreer 1.2.0 2023-06-15 [1] CRAN (R 4.4.0)
#> sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.4.0)
#> stringi 1.8.4 2024-05-06 [1] CRAN (R 4.4.0)
#> stringr 1.5.1 2023-11-14 [1] CRAN (R 4.4.0)
#> tibble 3.2.1 2023-03-20 [1] CRAN (R 4.4.0)
#> tidygraph 1.3.1 2024-01-30 [1] CRAN (R 4.4.0)
#> tidyr 1.3.1 2024-01-24 [1] CRAN (R 4.4.0)
#> tidyselect 1.2.1 2024-03-11 [1] CRAN (R 4.4.0)
#> tidytree 0.4.6 2023-12-12 [1] CRAN (R 4.4.0)
#> treeio 1.28.0 2024-04-30 [1] Bioconductor 3.19 (R 4.4.0)
#> tweenr 2.0.3 2024-02-26 [1] CRAN (R 4.4.0)
#> utf8 1.2.4 2023-10-22 [1] CRAN (R 4.4.0)
#> vctrs 0.6.5 2023-12-01 [1] CRAN (R 4.4.0)
#> viridis 0.6.5 2024-01-29 [1] CRAN (R 4.4.0)
#> viridisLite 0.4.2 2023-05-02 [1] CRAN (R 4.4.0)
#> withr 3.0.1 2024-07-31 [1] CRAN (R 4.4.0)
#> xfun 0.47 2024-08-17 [1] CRAN (R 4.4.0)
#> xml2 1.3.6 2023-12-04 [1] CRAN (R 4.4.0)
#> yaml 2.3.10 2024-07-26 [1] CRAN (R 4.4.0)
#> yulab.utils 0.1.6 2024-08-17 [1] CRAN (R 4.4.0)
#>
#> [1] /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library
#>
#> ────────────────────────────────────────────────────────────────────────────── |
Thanks @teunbrand @trekonom for the solution. Fixed in v1.4.2 |
It seems that the bulk_clones plot is sometimes missing the CNV state colors legend. Is that expected or a bug?
For example, here is the plot from the mouse tutorial with a proper legend:
![image](https://private-user-images.githubusercontent.com/6363505/320922693-d56a5e88-41e6-4705-91ae-eb09d2de37ab.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4Mjc2NzYsIm5iZiI6MTczOTgyNzM3NiwicGF0aCI6Ii82MzYzNTA1LzMyMDkyMjY5My1kNTZhNWU4OC00MWU2LTQ3MDUtOTFhZS1lYjA5ZDJkZTM3YWIucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMjEyMjU2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTI5NGZhMGNlYjVhNzM0NjdlNTU5MjA0NDU2MTZkYmJlZjAwYWE2NTU1ODc5OTMwYTkxN2M4NWQyMjBlNjczMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.wOhsmZCled9Zzm9_WSwckIUG3oOoU_eTFKbiu8Is6CE)
Compare that to the Interpreting Numbat results vignette where the legend only has two colors:
![image](https://private-user-images.githubusercontent.com/6363505/320922584-284d0aec-64f2-4faa-9940-98844dd41ae1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4Mjc2NzYsIm5iZiI6MTczOTgyNzM3NiwicGF0aCI6Ii82MzYzNTA1LzMyMDkyMjU4NC0yODRkMGFlYy02NGYyLTRmYWEtOTk0MC05ODg0NGRkNDFhZTEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxNyUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTdUMjEyMjU2WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTQ4NDhjZTUyNDMxNWMxZDQ4YTJkOTI5ZGFhNmVlNzA2YmRmNGFlZDY1ZGUxYTk4YTEwY2QzNDM5MTgzNzE2YyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.1H1MbpDaRqXGmOfUGjMRIBMf8HNiWKA4MmZXoDN2qgo)
The text was updated successfully, but these errors were encountered: