-
Notifications
You must be signed in to change notification settings - Fork 25
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
Total Set Size for each category #6
Comments
Hi Aureliano, thank you for your interest in my package. The feature that you are asking about is not directly supported by You can however make the a plot equivalent to I created a small example to demonstrate the approach. You can play around with the margins and library(tidyverse)
library(ggupset)
main_plot <- tidy_movies %>%
distinct(title, year, length, .keep_all=TRUE) %>%
ggplot(aes(x=Genres)) +
geom_bar() +
scale_x_upset(n_intersections = 20)
side_plot <- tidy_movies %>%
select(Genres) %>%
unnest(cols = Genres) %>%
count(Genres) %>%
mutate(Genres = fct_reorder(as.factor(Genres), n)) %>%
ggplot(aes(y = n, x = Genres)) +
geom_col() +
coord_flip() +
scale_y_reverse() +
xlab("") + ylab("") +
theme(axis.ticks.y = element_blank(), axis.text.y = element_blank())
cowplot::plot_grid(
cowplot::plot_grid(NULL, side_plot + theme(plot.margin = unit(c(1, -5, -5, 1), "pt")), ncol = 1, rel_heights = c(2.15, 1)),
main_plot, nrow = 1, rel_widths = c(1, 3)
)
#> Warning: Removed 100 rows containing non-finite values (stat_count). Created on 2020-02-29 by the reprex package (v0.3.0) I will keep this issue open as a reference for other people who might have a similar issue in the future. |
Thank you for your example. |
You may also want to check out my package: https://github.com/krassowski/complex-upset which does exactly what @const-ae suggests, glueing many ggplots under the hood, using |
Hi Michał, thanks for sharing. That looks like an interesting package to easily assemble more complex UpSet plots :) |
Related question: I'd like to be able to show the number of intersections above each bar. Currently I'm using |
Hey Michael, |
I added a new section to the README that explains how to add the numbers on top https://github.com/const-ae/ggupset#adding-numbers-on-top |
Perfect thanks @const-ae ! |
Hi,
How I add information about the total size of a set at the left of categories names, as the UpSetR does.
I'd like to use ggupset to generate a plot equal to upsetr, as the image below.
The text was updated successfully, but these errors were encountered: