complex-upset
complex-upset copied to clipboard
How to save the plot with `ggsave`?
When I try to add a title above with wrap = T, the ggsave fails
( upset( movies, genres, name='genre', width_ratio=0.1, min_size=10, stripes=c(alpha('grey90', 0.45), alpha('white', 0.3)),wrap = T ) & theme(plot.background=element_rect(fill='transparent', color=NA)) ) ggsave('upset.png', bg="transparent")
You need to pass the plot to the ggsave
function and then it works perfectly fine:
p = (
upset(
movies, genres, name='genre', width_ratio=0.1, min_size=10,
stripes=c(alpha('grey90', 0.45), alpha('white', 0.3)),
wrap = T
)
& theme(plot.background=element_rect(fill='transparent', color=NA))
)
ggsave('upset.png', p, bg="transparent")
See https://github.com/thomasp85/patchwork/issues/30.