Skip to contents

Plot grid from metadata.

Usage

plotGrid(
  spe,
  reverseY = FALSE,
  group.by = NULL,
  feature = NULL,
  assay = "counts",
  type = c("raw", "log", "cpm", "logcpm"),
  cols = NULL,
  pol.border = FALSE,
  pol.alpha = 1,
  probs = 0,
  label = NULL
)

Arguments

spe

A SpatialExperiment object.

reverseY

Reverse y coordinates.

group.by

values to group polygons by. Must be in spe@metadata$grid_density, or colData(spe) if gridLevelAnalysis is TRUE. If NULL, will try with cols if available.

feature

Feature to group polygons by. Must be in rownames(spe).

assay

Name of assay to use for plotting feature.

type

Transformation to apply for the group/feature. Options are "raw" , "log", "cpm", "logcpm", or a function that accepts and returns a vector of the same length.

cols

Colour palette. Can be a vector of colours or a function that accepts an integer n and return n colours.

pol.border

Boolean. Whether to draw border for each polygon.

pol.alpha

alpha of points between 0 and 1.

probs

Numeric value between 0 and 1, used for filtering uninformative grid. Only applicable for continuous values.

label

label for the legend

Value

A ggplot object.

Examples


data("xenium_bc_spe")

spe <- gridDensity(spe)

plotGrid(spe, group.by = "x_grid")