Learn R Programming

Seurat (version 5.4.0)

InteractiveSpatialPlot: Interactive Spatial Cell Selection Tool

Description

Launch an interactive gadget for lasso-based cell selection from a spatial Seurat object. Supports Visium, SlideSeq, and Vizgen data. Returns the cell names of the selected subset, suitable for downstream subsetting or analysis.

Usage

InteractiveSpatialPlot(
  object,
  image = NULL,
  image.scale = "lowres",
  group.by = NULL,
  alpha = 1,
  pt.size.factor = 1,
  overlay_image = TRUE
)

Value

A character vector of cell names selected via lasso, which can be used to subset the object.

Arguments

object

A Seurat object with spatial data.

image

Name of the spatial image stored in the object. If NULL, uses the default image for the object.

image.scale

Character. Which image scaling factor to use for spatial coordinate transformation ("lowres" by default).

group.by

Metadata variable (column name) to use for coloring cell points (e.g., cluster assignment). If NULL, uses "seurat_clusters" if available, otherwise all cells are grouped together.

alpha

Numeric transparency value for cell points (default 1.0).

pt.size.factor

Numeric scaling factor for point size (default 1.0).

overlay_image

Logical; if TRUE, overlays the tissue image in the background of the plot (default TRUE).

Examples

Run this code
if (FALSE) {
selected_cells <- InteractiveSpatialPlot(object = brain)
selected_cells <- InteractiveSpatialPlot(object = brain, overlay_image = FALSE)
}

Run the code above in your browser using DataLab