| upset_plot | R Documentation |
This is a minimalistic implementation of upset plots, as used to visualise
our qc_loci_report. It is not intended to be a general-purpose upset
plotting function, and it does not attempt to replicate all the features of
specialised packages. It produces a three-panel UpSet plot assembled with
patchwork:
Top panel - bar chart of intersection sizes, labelled.
Matrix panel - dot-and-line membership matrix with alternating row backgrounds for readability.
Left panel - horizontal bar chart of per-set totals.
upset_plot(
df,
sets = NULL,
min_size = 1L,
n_intersections = 40L,
bar_colour = "#2166ac",
dot_colour = "#2166ac",
empty_colour = "#d9d9d9",
set_bar_colour = "#4dac26",
text_size = 11
)
df |
A data frame with logical set-membership columns. |
sets |
Character vector of column names to use as sets.
Defaults to |
min_size |
Integer. Intersections with fewer than this many rows
are dropped. Default |
n_intersections |
Integer. Maximum number of intersections to display
(top-n by count). Default |
bar_colour |
Fill colour for the intersection size bars.
Default |
dot_colour |
Colour for filled dots and connecting lines in the
membership matrix. Default |
empty_colour |
Colour for absent-set dots in the matrix.
Default |
set_bar_colour |
Fill colour for the set-size bars.
Default |
text_size |
Base font size (pts) passed to all
|
A patchwork object. Print it or pass it to
ggsave.
set.seed(1)
df <- data.frame(
A = sample(c(TRUE, FALSE), 100, replace = TRUE),
B = sample(c(TRUE, FALSE), 100, replace = TRUE),
C = sample(c(TRUE, FALSE), 100, replace = TRUE)
)
upset_plot(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.