Skip to content
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

Broken guides with ggplot2 v3.5.0 #360

Open
teng-gao opened this issue Apr 10, 2024 · 2 comments
Open

Broken guides with ggplot2 v3.5.0 #360

teng-gao opened this issue Apr 10, 2024 · 2 comments
Labels
reprex needs a minimal reproducible example

Comments

@teng-gao
Copy link

With ggplot2 v3.4.1, the guides are collected normally:

library(numbat)
library(dplyr)
nb = readRDS(url('http://pklab.med.harvard.edu/teng/data/nb_TNBC1.rds'))

nb$bulk_clones %>% 
  filter(n_cells > 50) %>%
  plot_bulks(
    min_LLR = 10, # filtering CNVs by evidence
    legend = TRUE
  )

image

With ggplot2 v3.5.0, guides are not combined correctly and some are missing:
image

SessionInfo:

R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.6 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] dplyr_1.1.3  numbat_1.4.0 Matrix_1.6-5

loaded via a namespace (and not attached):
 [1] viridis_0.6.2          tidyr_1.3.0            tidygraph_1.3.1       
 [4] jsonlite_1.8.8         viridisLite_0.4.1      ggraph_2.1.0          
 [7] RhpcBLASctl_0.21-247.1 RcppParallel_5.1.6     yulab.utils_0.0.6     
[10] ggrepel_0.9.2          pillar_1.9.0           lattice_0.20-45       
[13] glue_1.7.0             quadprog_1.5-8         phangorn_2.11.1       
[16] uuid_1.1-0             digest_0.6.27          polyclip_1.10-4       
[19] colorspace_2.1-0       ggfun_0.0.9            htmltools_0.5.4       
[22] pkgconfig_2.0.3        logger_0.2.2           purrr_1.0.1           
[25] patchwork_1.2.0        tidytree_0.4.6         scales_1.3.0          
[28] ggplotify_0.1.0        tweenr_2.0.2           ggforce_0.4.1         
[31] tibble_3.2.1           generics_0.1.0         farver_2.1.1          
[34] ggplot2_3.5.0          withr_3.0.0            parallelDist_0.2.6    
[37] repr_1.1.6             lazyeval_0.2.2         cli_3.6.2             
[40] magrittr_2.0.3         crayon_1.5.2           evaluate_0.20         
[43] fansi_1.0.4            nlme_3.1-161           MASS_7.3-58           
[46] Cairo_1.6-0            tools_4.2.2            data.table_1.14.10    
[49] lifecycle_1.0.4        stringr_1.5.1          aplot_0.1.9           
[52] hahmmr_1.0.0           ggtree_3.6.2           munsell_0.5.0         
[55] compiler_4.2.2         gridGraphics_0.5-1     rlang_1.1.3           
[58] grid_4.2.2             pbdZMQ_0.3-9           IRkernel_1.3.2        
[61] igraph_2.0.2           base64enc_0.1-3        labeling_0.4.2        
[64] scistreer_1.2.0        gtable_0.3.4           codetools_0.2-18      
[67] graphlayouts_0.8.4     R6_2.5.1               gridExtra_2.3         
[70] fastmap_1.1.0          utf8_1.2.2             fastmatch_1.1-3       
[73] treeio_1.22.0          ape_5.7-1              stringi_1.8.3         
[76] parallel_4.2.2         IRdisplay_1.1          Rcpp_1.0.12           
[79] vctrs_0.6.5            tidyselect_1.2.0
@thomasp85
Copy link
Owner

Can you please provide a minimal reprex?

Specifically I think this is due to changes in ggplot2 in how missing data points contribute to guides, rather than an issue in patchwork, but I may be mistaken

@thomasp85 thomasp85 added the reprex needs a minimal reproducible example label Aug 26, 2024
@trekonom
Copy link

trekonom commented Sep 8, 2024

The issue was cross-posted here and as the comments by @teunbrand make clear is due to the recent change in ggplot2 which now requires to set show.legend=TRUE in the geom to display a legend key for missing categories and hence requires a fix on side of numbat.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
reprex needs a minimal reproducible example
Projects
None yet
Development

No branches or pull requests

3 participants