Skip to contents

Plot density correlation between two cell types

Usage

plotDensCor(
  spe,
  celltype1 = NULL,
  celltype2 = NULL,
  by.roi = TRUE,
  fit = c("spline", "linear"),
  df = 3,
  ...
)

Arguments

spe

A SpatialExperiment object.

celltype1

Cell type 1 to compare.

celltype2

Cell type 2 to compare.

by.roi

Logical. Plot facet by ROIs or not.

fit

Character. Options are "spline" and "linear".

df

Integer. Degrees of freedom of the spline fit. Default to 3 (i.e., a cubic spline fit).

...

aesthetic mappings to pass to ggplot2::aes().

Value

A ggplot object.

Examples


data("xenium_bc_spe")

coi <- c("Breast cancer", "Fibroblasts")

spe <- gridDensity(spe, coi = coi)

spe <- findROI(spe, coi = coi, method = "walktrap")

plotDensCor(spe, celltype1 = "Breast cancer", celltype2 = "Fibroblasts")