## Use a modified version of the movies data provided with the package UpSetR
library(tidyverse)
theme_set(theme_bw())
sets <- c("Action", "Comedy", "Drama", "Thriller", "Romance")
movies <- system.file("extdata", "movies.tsv.gz", package = "SimpleUpset") %>%
read_tsv() %>%
mutate(
Decade = fct_inorder(Decade) %>% fct_rev()
)
simpleUpSet(movies, sets)
## Add a detailed upper plot
simpleUpSet(
movies, sets, n_intersect = 10,
annotations = list(
list(
aes(y = AvgRating),
geom_jitter(aes(colour = Decade), height = 0, width = 0.3, alpha = 0.5),
geom_violin(fill = NA, quantiles = 0.5, quantile.linetype = 1),
scale_colour_brewer(palette = "Paired"),
guides(colour = guide_legend(nrow = 2, reverse = TRUE))
)
), guides = "collect"
) &
theme(legend.position = "bottom")
## Modify set colours
set_cols <- c(
Action = "red", Comedy = "grey23", Drama = "red",
Romance = "grey23", Thriller = "grey23"
)
simpleUpSet(
movies, sets,
set_layers = default_set_layers(
fill = "set", scale_fill_manual(values = set_cols), guides(fill = guide_none())
)
)
Run the code above in your browser using DataLab