Skip to contents

Each colored point is one selected column's mean across spots. Each box summarizes these means within a group, not variation across spots or a confidence interval. Its center line is the median of the column means.

Usage

plot_boxplot(
  spe,
  column,
  groups,
  sources,
  title = NULL,
  xlab = NULL,
  ylab = "Mean value",
  colors = NULL,
  point_size = 3
)

Arguments

spe

A SpatialExperiment.

column

Names of numeric colData columns to compare.

groups

Named character vector mapping column names to groups on the x-axis (e.g. cell types). Order follows first appearance in column.

sources

Named character vector mapping column names to sources shown by point color (e.g. methods). Each group/source pair must be unique.

title, xlab

Optional plot title and x-axis label.

ylab

Y-axis label, default "Mean value".

colors

Optional named character vector mapping sources to colors.

point_size

Size of the points in the plot and legend, in ggplot2 size units.

Value

A ggplot object. Its data contains column, group, source, and mean. Further styling, including percentage axes, can be added with ggplot2.

Details

Values are used without normalization or aggregation of cell types. Spots with any nonfinite selected value are omitted from all means, with a warning. Constant columns are retained. No statistical tests are performed.