Open januz opened 3 years ago
This an an excellent idea for an enhancement. How would you expect this to be invoked? Would it be a new argument to the upset()
function?
In the meantime a workaround which is not fully functional but always something:
upset(
head(movies, 100),
genres,
encode=FALSE,
sort_intersections_by=c('degree', 'cardinality'),
matrix=intersection_matrix() + coord_flip(),
base_annotations=list(
'Size'=(
intersection_size(text=list(hjust=-0.2, vjust=0.5))
+ coord_flip()
+ theme(axis.text.y=element_blank())
)
),
set_sizes=FALSE
) + patchwork::plot_layout(design='BA', heights=c(1, 1), widths=c(1, 2))
Adding set sizes will require modifications because the coord_flip
there is hard-coded; in fact it should not be used any longer since ggplot now has a proper support for horizontal orientation.
Yes, I was imagining a new argument to the upset()
function, e.g., flip_axes
.
Thanks for the work around this looks similar a lot like what I had imagined! While I like the verbatim descriptions of the intersections as rows labels, I often work with more wordy categories, so I was imagining the categories as column headers of the intersection matrix (in 45 degree angle). Furthermore, I would prefer to have the "intersection" label below the bars (like the "group" label below the intersection matrix).
Thanks so much for your responsiveness and willingness to implement new features. Greatly appreciated!!
Thanks for the workaround! I would also find Januz's suggestion useful if implemented, but for my purposes it's easy enough to put in by hand.
Thank you for the workaround. This is almost what I'm looking for. Would it be possible to add set labels (action, comedy, etc) at the bottom where the "group" label is? In similar way as they appear in normal upset plot?
Is your feature request related to a problem? Please describe.
I was wondering whether it would be possible to flip the axes of the upset plot so that the intersection matrix's orientation would be vertical and the bars would be horizontal. Especially, when working with a lot of intersections, this would make the plot more easily readable in my opinion.
Describe the solution you'd like
Add a function argument to
upset()
that flips everything, ideally including additional plots, etc.Describe alternatives you've considered
I wondered whether one could manipulate the different plot elements
upset()
uses manually but wasn't successful.Context (required)
ComplexUpset version: 1.3.0
R version details
```R $platform [1] "x86_64-apple-darwin17.0" $arch [1] "x86_64" $os [1] "darwin17.0" $system [1] "x86_64, darwin17.0" $status [1] "" $major [1] "4" $minor [1] "0.4" $year [1] "2021" $month [1] "02" $day [1] "15" $`svn rev` [1] "80002" $language [1] "R" $version.string [1] "R version 4.0.4 (2021-02-15)" $nickname [1] "Lost Library Book" ```R session information
```R R version 4.0.4 (2021-02-15) Platform: x86_64-apple-darwin17.0 (64-bit) Running under: macOS Big Sur 10.16 Matrix products: default LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] ComplexUpset_1.3.0 forcats_0.5.1 stringr_1.4.0 dplyr_1.0.5 purrr_0.3.4 readr_1.4.0 tidyr_1.1.3 tibble_3.1.3 ggplot2_3.3.5 tidyverse_1.3.1 shiny_1.6.0 loaded via a namespace (and not attached): [1] Rcpp_1.0.6 lubridate_1.7.10 assertthat_0.2.1 digest_0.6.27 utf8_1.2.2 mime_0.10 R6_2.5.0 cellranger_1.1.0 backports_1.2.1 reprex_2.0.0 httr_1.4.2 [12] pillar_1.6.2 rlang_0.4.11 readxl_1.3.1 rstudioapi_0.13 miniUI_0.1.1.1 jquerylib_0.1.4 checkmate_2.0.0 labeling_0.4.2 munsell_0.5.0 broom_0.7.9 compiler_4.0.4 [23] httpuv_1.6.1 modelr_0.1.8 pkgconfig_2.0.3 htmltools_0.5.1.1 tidyselect_1.1.0 fansi_0.5.0 crayon_1.4.1 dbplyr_2.1.1 withr_2.4.2 later_1.2.0 grid_4.0.4 [34] jsonlite_1.7.2 xtable_1.8-4 gtable_0.3.0 lifecycle_1.0.0 DBI_1.1.1 magrittr_2.0.1 scales_1.1.1 strcode_0.2.0 cli_3.0.1 stringi_1.5.3 cachem_1.0.4 [45] farver_2.1.0 fs_1.5.0 promises_1.2.0.1 xml2_1.3.2 bslib_0.2.5.1 ellipsis_0.3.2 generics_0.1.0 vctrs_0.3.8 tools_4.0.4 glue_1.4.2 hms_1.0.0 [56] fastmap_1.1.0 colorspace_2.0-2 rvest_1.0.1 haven_2.4.1 patchwork_1.1.1 sass_0.4.0 ```