Skip to contents

Counts, for each distinct value of vars, the set of Compare groups it appears in, and renders an UpSet-style intersection plot via ggupset::scale_x_upset(), optionally annotated with absolute or percentage intersection-size labels.

Usage

plot_upset(
  df,
  vars,
  n_intersections = 10,
  Compare = "Condition",
  labels = "perc",
  lab.size = 2,
  plot.margin = ggplot2::unit(c(0.2, 0.2, 0.2, 0.2), "cm")
)

Arguments

df

A pep_all-shaped data frame.

vars

Column (tidy-evaluated) whose distinct values define the items being compared, e.g. Sequence.

n_intersections

Maximum number of intersections to display.

Compare

Name (string) of the column defining the groups compared (becomes the upset's set membership axis), e.g. "Condition".

labels

One of "abs" (absolute intersection counts, the default), "perc" (percentage of the total), or any other value to omit the per-bar count labels entirely. Defaults to "perc".

lab.size

Text size of the per-bar count/percentage labels.

plot.margin

Plot margin, as unit.

Value

A ggplot2/ggupset object with an intersection-count bar chart and a caption reporting the total unique count and intersections shown.

Examples

if (FALSE) { # \dontrun{
plot_upset(pep_all, Sequence, n_intersections = 10, Compare = "Condition")
} # }