Visualize clusters or other categorical groupings in a spatial context

ImageDimPlot(
  object,
  fov = NULL,
  boundaries = NULL,
  group.by = NULL,
  split.by = NULL,
  cols = NULL,
  shuffle.cols = FALSE,
  size = 0.5,
  molecules = NULL,
  mols.size = 0.1,
  mols.cols = NULL,
  mols.alpha = 1,
  nmols = 1000,
  alpha = 1,
  border.color = "white",
  border.size = NULL,
  na.value = "grey50",
  dark.background = TRUE,
  crop = FALSE,
  cells = NULL,
  overlap = FALSE,
  axes = FALSE,
  combine = TRUE,
  coord.fixed = TRUE,
  flip_xy = TRUE
)

Arguments

object

A Seurat object

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

group.by

Name of one or more metadata columns to group (color) cells by (for example, orig.ident); pass 'ident' to group by identity class

split.by

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

cols

Vector of colors, each color corresponds to an identity class. This may also be a single character or numeric value corresponding to a palette as specified by brewer.pal.info. By default, ggplot2 assigns colors. We also include a number of palettes from the pals package. See DiscretePalette for details.

shuffle.cols

Randomly shuffle colors when a palette or vector of colors is provided to cols

size

Point size for cells when plotting centroids

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.

mols.alpha

Alpha value for molecules, should be between 0 and 1

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

na.value

Color value for NA points when using custom scale

dark.background

Set plot background to black

crop

Crop the plots to area with cells only

cells

Vector of cells to plot (default is all cells)

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 patchwork ggplot object.If FALSE, return a list of ggplot objects

coord.fixed

Plot cartesian coordinates with fixed aspect ratio

flip_xy

Flag to flip X and Y axes. Default is FALSE.

Value

If combine = TRUE, a patchwork

ggplot object; otherwise, a list of ggplot objects