ImageFeaturePlot: Spatial Feature Plots

View source: R/visualization.R

ImageFeaturePlotR Documentation

Spatial Feature Plots

Description

Visualize expression in a spatial context

Usage

ImageFeaturePlot(
  object,
  features,
  fov = NULL,
  boundaries = NULL,
  cols = if (isTRUE(x = blend)) {
     c("lightgrey", "#ff0000", "#00ff00")
 } else {
   
     c("lightgrey", "firebrick1")
 },
  size = 0.5,
  min.cutoff = NA,
  max.cutoff = NA,
  split.by = NULL,
  molecules = NULL,
  mols.size = 0.1,
  mols.cols = NULL,
  nmols = 1000,
  alpha = 1,
  border.color = "white",
  border.size = NULL,
  dark.background = TRUE,
  blend = FALSE,
  blend.threshold = 0.5,
  crop = FALSE,
  cells = NULL,
  scale = c("feature", "all", "none"),
  overlap = FALSE,
  axes = FALSE,
  combine = TRUE,
  coord.fixed = TRUE
)

Arguments

object

Seurat object

features

Vector of features to plot. Features can come from:

  • An Assay feature (e.g. a gene name - "MS4A1")

  • A column name from meta.data (e.g. mitochondrial percentage - "percent.mito")

  • A column name from a DimReduc object corresponding to the cell embedding values (e.g. the PC 1 scores - "PC_1")

fov

Name of FOV to plot

boundaries

A vector of segmentation boundaries per image to plot; can be a character vector, a named character vector, or a named list. Names should be the names of FOVs and values should be the names of segmentation boundaries

cols

The two colors to form the gradient over. Provide as string vector with the first color corresponding to low values, the second to high. Also accepts a Brewer color scale or vector of colors. Note: this will bin the data into number of colors provided. When blend is TRUE, takes anywhere from 1-3 colors:

1 color:

Treated as color for double-negatives, will use default colors 2 and 3 for per-feature expression

2 colors:

Treated as colors for per-feature expression, will use default color 1 for double-negatives

3+ colors:

First color used for double-negatives, colors 2 and 3 used for per-feature expression, all others ignored

size

Point size for cells when plotting centroids

min.cutoff, max.cutoff

Vector of minimum and maximum cutoff values for each feature, may specify quantile in the form of 'q##' where '##' is the quantile (eg, 'q1', 'q10')

split.by

A factor in object metadata to split the plot by, pass 'ident' to split by cell identity'

molecules

A vector of molecules to plot

mols.size

Point size for molecules

mols.cols

A vector of color for molecules. The "Set1" palette from RColorBrewer is used by default.

nmols

Max number of each molecule specified in 'molecules' to plot

alpha

Alpha value for plotting (default is 1)

border.color

Color of cell segmentation border; pass NA to suppress borders for segmentation-based plots

border.size

Thickness of cell segmentation borders; pass NA to suppress borders for centroid-based plots

dark.background

Set plot background to black

blend

Scale and blend expression values to visualize coexpression of two features

blend.threshold

The color cutoff from weak signal to strong signal; ranges from 0 to 1.

crop

Crop the plots to area with cells only

cells

Vector of cells to plot (default is all cells)

scale

Set color scaling across multiple plots; choose from:

  • feature”: Plots per-feature are scaled across splits

  • all”: Plots per-feature are scaled across all features

  • none”: Plots are not scaled; note: setting scale to “none” will result in color scales that are not comparable between plots

Ignored if blend = TRUE

overlap

Overlay boundaries from a single image to create a single plot; if TRUE, then boundaries are stacked in the order they're given (first is lowest)

axes

Keep axes and panel background

combine

Combine plots into a single patchworked ggplot object. If FALSE, return a list of ggplot objects

coord.fixed

Plot cartesian coordinates with fixed aspect ratio

Value

If combine = TRUE, a patchwork ggplot object; otherwise, a list of ggplot objects


Seurat documentation built on May 29, 2024, 4:20 a.m.