Skip to contents

Creates a scatterplot to compare two result columns, either from a single SpatialExperiment (use spe + value1 + value2) or from two different objects (use spe1 + spe2 + value1 + value2).

Usage

plot_scatter(
  spe = NULL,
  value1,
  value2,
  spe1 = NULL,
  spe2 = NULL,
  log_scale = FALSE,
  dot_color = "#1f77b4",
  point_alpha = 0.8,
  fix_coords = FALSE,
  coord_range = NULL,
  title = "Comparative Scatterplot",
  xlab = value1,
  ylab = value2,
  point_size = 2,
  stats_size = 15
)

Arguments

spe

SpatialExperiment with quantification results

value1

Numeric colData column to plot on the x-axis (e.g. cell abundance or activity).

value2

Numeric colData column to plot on the y-axis.

spe1

First SpatialExperiment object.

spe2

Second SpatialExperiment object.

log_scale

Logical, whether to use log scale for axes.

dot_color

Color for the dots in the plot.

point_alpha

Alpha for the dots, controlling transparency.

fix_coords

Logical, whether to use equal axis ranges and a 1:1 aspect ratio.

coord_range

Optional increasing numeric vector of length 2 setting both axis limits in original data units. NULL uses automatic limits.

title

Title of the plot, or NULL to omit it.

xlab, ylab

Axis labels; default to the selected column names. Use NULL to omit a label.

point_size

Size of the points, in ggplot2 size units.

stats_size

Font size of the Pearson r and p-value annotation, in points.

Value

A scatterplot.

Details

The annotation reports Pearson's r and its standard correlation-test p-value, which does not account for spatial dependence between spots. The solid line is a linear regression; the dashed line represents equality.