complex-upset icon indicating copy to clipboard operation
complex-upset copied to clipboard

Error in plot_them(plot)!

Open katekt12 opened this issue 10 months ago • 3 comments

Describe the bug Hey, I have used Upset Plot before and it produced exactly like in the documentation. But, I tried to do it again and it gave me this error. I tried updating my package (both ggplot and ComplexUpset) and it still does the same thing. Can you help to debug this? I don't know what happened. This is the error that I got:

< Error in plot_theme(): ! The legend.text.align theme element is not defined in the element hierarchy. Backtrace:

  1. base (local) <fn>(x)
  2. patchwork:::print.patchwork(x)
  3. patchwork:::build_patchwork(plot, plot$layout$guides %||% "auto")
  4. base::lapply(x$plots, plot_table, guides = guides)
  5. patchwork:::plot_table.ggplot(X[[i]], ...)
  6. ggplot2::ggplotGrob(x)
  7. ggplot2:::ggplot_gtable.ggplot_built(ggplot_build(x))
  8. ggplot2:::plot_theme(plot)>

Code to reproduce

movies = as.data.frame(ggplot2movies::movies)
head(movies, 3)

genres = colnames(movies)[18:24]
genres

movies[genres] = movies[genres] == 1
t(head(movies[genres], 3))

movies[movies$mpaa == '', 'mpaa'] = NA
movies = na.omit(movies)

upset(movies, genres, name='genre', width_ratio=0.1)

Expected behavior It should produce this plot similar like in the documentation. image

Screenshots image

Context (required)

ComplexUpset version: 1.3.3

R version details
<!-- $platform
[1] "x86_64-apple-darwin20"

$arch
[1] "x86_64"

$os
[1] "darwin20"

$system
[1] "x86_64, darwin20"

$status
[1] ""

$major
[1] "4"

$minor
[1] "3.1"

$year
[1] "2023"

$month
[1] "06"

$day
[1] "16"

$`svn rev`
[1] "84548"

$language
[1] "R"

$version.string
[1] "R version 4.3.1 (2023-06-16)"

$nickname
[1] "Beagle Scouts" -->
R session information
<!-- R version 4.3.1 (2023-06-16)
Platform: x86_64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.3.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-x86_64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Australia/Melbourne
tzcode source: internal

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

other attached packages:
 [1] devtools_2.4.5              usethis_2.2.3               ComplexUpset_1.3.3          ggpubr_0.6.0               
 [5] rstatix_0.7.2               ggrepel_0.9.5               ggfortify_0.4.16            reshape2_1.4.4             
 [9] DESeq2_1.42.1               SummarizedExperiment_1.32.0 Biobase_2.62.0              MatrixGenerics_1.14.0      
[13] matrixStats_1.3.0           GenomicRanges_1.54.1        GenomeInfoDb_1.38.8         IRanges_2.36.0             
[17] S4Vectors_0.40.2            BiocGenerics_0.48.1         edgeR_4.0.16                limma_3.58.1               
[21] dplyr_1.1.4                 tidyr_1.3.1                 ggplot2_3.5.0              

loaded via a namespace (and not attached):
 [1] bitops_1.0-7            gridExtra_2.3           remotes_2.5.0           readxl_1.4.3            rlang_1.1.3            
 [6] magrittr_2.0.3          compiler_4.3.1          vctrs_0.6.5             profvis_0.3.8           stringr_1.5.1          
[11] pkgconfig_2.0.3         crayon_1.5.2            fastmap_1.1.1           backports_1.4.1         XVector_0.42.0         
[16] ellipsis_0.3.2          labeling_0.4.3          utf8_1.2.4              promises_1.3.0          rmarkdown_2.26         
[21] sessioninfo_1.2.2       purrr_1.0.2             xfun_0.43               zlibbioc_1.48.2         cachem_1.0.8           
[26] jsonlite_1.8.8          later_1.3.2             DelayedArray_0.28.0     BiocParallel_1.36.0     broom_1.0.5            
[31] parallel_4.3.1          R6_2.5.1                bslib_0.7.0             stringi_1.8.3           car_3.1-2              
[36] pkgload_1.3.4           jquerylib_0.1.4         cellranger_1.1.0        Rcpp_1.0.12             knitr_1.45             
[41] httpuv_1.6.15           Matrix_1.6-5            tidyselect_1.2.1        rstudioapi_0.16.0       abind_1.4-5            
[46] yaml_2.3.8              codetools_0.2-20        miniUI_0.1.1.1          pkgbuild_1.4.4          lattice_0.22-6         
[51] tibble_3.2.1            plyr_1.8.9              shiny_1.8.1.1           withr_3.0.0             evaluate_0.23          
[56] urlchecker_1.0.1        pillar_1.9.0            BiocManager_1.30.22     carData_3.0-5           generics_0.1.3         
[61] RCurl_1.98-1.14         munsell_0.5.1           scales_1.3.0            xtable_1.8-4            glue_1.7.0             
[66] tools_4.3.1             locfit_1.5-9.9          ggsignif_0.6.4          fs_1.6.3                grid_4.3.1             
[71] colorspace_2.1-0        GenomeInfoDbData_1.2.11 patchwork_1.2.0         cli_3.6.2               fansi_1.0.6            
[76] S4Arrays_1.2.1          gtable_0.3.4            sass_0.4.9              digest_0.6.35           SparseArray_1.2.4      
[81] htmlwidgets_1.6.4       farver_2.1.1            memoise_2.0.1           htmltools_0.5.8.1       lifecycle_1.0.4        
[86] mime_0.12               statmod_1.5.0        -->

katekt12 avatar Apr 24 '24 04:04 katekt12

Hi I am also having this error. Here is the code I used to reproduce error ComplexUpset::upset( movies, c("Action", "Comedy", "Drama"), width_ratio=0.2, group_by='sets', queries=list( upset_query(group='Drama', color='maroon'), upset_query(group='Comedy', color='blue'), upset_query(group='Action', color='orange'), upset_query(set='Drama', fill='maroon'), upset_query(set='Comedy', fill='blue'), upset_query(set='Action', fill='orange') ) ) Is there any way to resolve this error

--Rohit

dnyansagar avatar Apr 29 '24 11:04 dnyansagar

This behavior is explained in another issue: https://github.com/krassowski/complex-upset/issues/195 To fix, you need to uninstall the package using remove.packages("ComplexUpset") and reinstall with install.packages("ComplexUpset", type = "source"). That fixed it for me!

karajones avatar Apr 29 '24 16:04 karajones

Thanks Kara!

dnyansagar avatar Apr 30 '24 08:04 dnyansagar