scale_x_upset | R Documentation |
This function takes a list column and turns it into a combination matrix
axis. It internally wraps the call to scale_x_mergelist()
and
axis_combmatrix()
and makes sure that the elements are sorted by
size.
scale_x_upset(
order_by = c("freq", "degree"),
n_sets = Inf,
n_intersections = Inf,
sets = NULL,
intersections = NULL,
reverse = FALSE,
ytrans = "identity",
...,
position = "bottom"
)
order_by |
either "freq" or "degree". Default: "freq" |
n_sets |
maximum number of sets that are displayed. Default: Inf |
n_intersections |
maximum number of intersections that are displayed. Default: Inf |
sets |
character vector that specifies which sets are displayed |
intersections |
a list of character vectors that specifies which intersections are displayed |
reverse |
boolean if the order of the intersections is reversed. Default: FALSE |
ytrans |
transformers for y axis. For more information see
|
... |
additional parameters for |
position |
either "top" or "bottom" to specify where the combination matrix is drawn. Default: "bottom" |
library(ggplot2)
ggplot(tidy_movies[1:100, ], aes(x=Genres)) +
geom_bar() +
scale_x_upset(reverse = TRUE, sets=c("Drama", "Action"))
ggplot(tidy_movies[1:100, ], aes(x=Genres)) +
geom_bar() +
scale_x_upset(n_intersections = 5, ytrans="sqrt")
ggplot(tidy_movies[1:100, ], aes(x=Genres, y=year)) +
geom_boxplot() +
scale_x_upset(intersections = list(c("Drama", "Comedy"), c("Short"), c("Short", "Animation")),
sets = c("Drama", "Comedy", "Short", "Animation", "Horror"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.