View source: R/layout-quad-upset.R
ggupset | R Documentation |
ggupset
is a specialized version of quad_discrete()
, which simplifies
the creation of Upset plot.
ggupset(
data = NULL,
mapping = aes(),
...,
direction = "h",
point = NULL,
line = NULL,
rect = NULL,
width = NA,
height = NA,
theme = NULL,
active = NULL
)
data |
Data used to create the UpSet plot. |
mapping |
Default list of aesthetic mappings to use for main plot in the layout. If not specified, must be supplied in each layer added to the main plot. |
... |
Additional arguments passed to |
direction |
A string indicating the direction of the UpSet plot,
|
point |
A list of parameters passed to
|
line |
A list of parameters passed to
|
rect |
A list of parameters passed to
|
width , height |
The relative width/height of the main plot, can be a
|
theme |
A |
active |
A |
The data input will be converted to a matrix using fortify_matrix()
, and
the data in the underlying main plot will contain the following columns:
.panel_x
and .panel_y
: the column and row panel groups.
.x
and .y
: an integer index of x
and y
coordinates
.discrete_x
and .discrete_y
: a factor of the data labels (only
applicable when .row_names
and .column_names
exists).
.row_names
and .column_names
: A character of the row and column names
of the original matrix (only applicable when names exist).
.row_index
and .column_index
: the row and column index of the original
matrix.
value
: the actual matrix value.
set.seed(123)
lt <- list(
a = sample(letters, 5),
b = sample(letters, 10),
c = sample(letters, 15)
)
ggupset(tune(lt)) +
scale_fill_manual(values = c("#F0F0F0", "white"), guide = "none") +
scale_color_manual(values = c("grey", "black"), guide = "none") +
anno_top() +
ggalign(data = function(d) ggalign_attr(d, "intersection_sizes")) +
ggplot2::geom_bar(aes(y = .data$value), stat = "identity") +
anno_right() +
ggalign(data = function(d) ggalign_attr(d, "set_sizes")) +
ggplot2::geom_bar(aes(x = .data$value),
stat = "identity",
orientation = "y"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.