
Batch spatial dimensionality-reduction (cell-type) plots
PlotSpatialDimPlots.RdProduces Seurat::SpatialDimPlot() panels for each image in the object,
one figure per metadata variable in group_by_vars. Supports the same
"auto" / "metadata" layout modes as
PlotSpatialFeaturePlots(). When multiple variables are supplied,
join_plots = TRUE tiles them into a single page.
Usage
PlotSpatialDimPlots(
seurat_object,
group_by_vars = NULL,
layout_method = "auto",
row.by = NULL,
images_to_plot = NULL,
remove_outliers = FALSE,
outlier_prob = 0.01,
size_override = NULL,
uniform_size = FALSE,
calcptsizesc = 100,
colors = NULL,
number_labels = FALSE,
legendnrow = 3,
legend.side = "bottom",
legend.direction = "horizontal",
join_plots = FALSE,
join_nrow = NULL,
join_ncol = NULL,
output_dir = NULL,
rowannsize = 16,
imgalpha = 1,
alpha = 1,
object_name = "",
group.by = NULL,
cluster_colors = NULL,
subset_name = "",
file_name = NULL,
width = NULL,
height = NULL,
timestamp = FALSE
)
GenerateSpatialDimMaps(
seurat_object,
group_by_vars = NULL,
layout_method = "auto",
row.by = NULL,
images_to_plot = NULL,
remove_outliers = FALSE,
outlier_prob = 0.01,
size_override = NULL,
uniform_size = FALSE,
calcptsizesc = 100,
colors = NULL,
number_labels = FALSE,
legendnrow = 3,
legend.side = "bottom",
legend.direction = "horizontal",
join_plots = FALSE,
join_nrow = NULL,
join_ncol = NULL,
output_dir = NULL,
rowannsize = 16,
imgalpha = 1,
alpha = 1,
object_name = "",
group.by = NULL,
cluster_colors = NULL,
subset_name = "",
file_name = NULL,
width = NULL,
height = NULL,
timestamp = FALSE
)Arguments
- seurat_object
A Seurat object with spatial images.
- group_by_vars
Character vector. Metadata columns to plot.
- layout_method
Character.
"auto"or"metadata". Default"auto".- row.by
Character or
NULL. Slide-level metadata column for row grouping (required for"metadata"layout).- images_to_plot
Character vector or
NULL. Images to include.- remove_outliers
Logical. Trim outlier cells. Default
FALSE.- outlier_prob
Numeric. Quantile trim level. Default
0.01.- size_override
Scalar or named numeric list. A plain number applies to all images; a named list applies per image.
- uniform_size
Logical. Use the median point size across all images. Default
FALSE.- calcptsizesc
Numeric. Scaling constant for automatic point-size calculation; larger values yield larger spots. Radius-aware, so the same value works across Visium and Visium HD. Default
100.- colors
Named character vector. Colors for each group level.
NULLauto-resolves from PrepObject orNour_pal. Supersedes the deprecatedcluster_colors.- number_labels
Logical. Prefix each legend label with a zero-padded index (e.g., "01. CellType"). Default
FALSE.- legendnrow
Integer or vector. Number of rows the categorical legend wraps into; PDF dimensions scale automatically to fit. When
group_by_varshas multiple variables, pass a vector aligned positionally (e.g.c(3, 1)) or named by variable (e.g.c(seurat_clusters = 3, Diagnosis = 1)) to set a different row count per variable; a single value applies to all. Default3.- legend.side
Character. Where to place the legend panel:
"bottom"(default),"top","left", or"right".- legend.direction
Character. Internal layout of legend entries:
"horizontal"(default, entries in rows) or"vertical"(entries stacked in one column).- join_plots
Logical. When
group_by_varshas more than one variable, combine all per-variable figures into a single page instead of one page each. DefaultFALSE.- join_nrow, join_ncol
Integer or
NULL. Grid layout forjoin_plots.NULLauto-arranges into a near-square grid.- output_dir
Character or
NULL. PDF output directory. WhenNULLthe plot is printed to the active device and returned invisibly.- rowannsize
Numeric. Font size for the row-group annotation label. Default
16.- imgalpha
Numeric. Tissue image transparency. Default
1.- alpha
Numeric. Spot transparency. Default
1.- object_name
Character. Label appended to PDF filenames. Default
"".- group.by
Character vector. Preferred alias for
group_by_vars.- cluster_colors
Named character vector. Deprecated alias for
colors.- subset_name
Character. Optional second label appended to PDF filenames after
object_name. Default"".- file_name
Character or
NULL. Base name (no extension) for the saved PDF.NULL(default) auto-deduces fromobject_name,subset_name,row.by, and the grouping variable(s).- width, height
Numeric or
NULL. Override the auto-calculated PDF dimensions in inches.NULL(default) auto-sizes to fit the image grid and legend.- timestamp
Logical. When
TRUE, append a_YYYYMMDD-HHMMSSstamp to the saved file name so repeated runs are versioned instead of overwriting the previous PDF. DefaultFALSE.