SpatialPlot plots a feature or discrete grouping (e.g. cluster assignments) as spots over the image that was collected. We also provide SpatialFeaturePlot and SpatialDimPlot as wrapper functions around SpatialPlot for a consistent naming framework.

SpatialPlot(
object,
group.by = NULL,
features = NULL,
images = NULL,
cols = NULL,
image.alpha = 1,
crop = TRUE,
slot = "data",
min.cutoff = NA,
max.cutoff = NA,
cells.highlight = NULL,
cols.highlight = c("#DE2D26", "grey50"),
facet.highlight = FALSE,
label = FALSE,
label.size = 5,
label.color = "white",
label.box = TRUE,
repel = FALSE,
ncol = NULL,
combine = TRUE,
pt.size.factor = 1.6,
alpha = c(1, 1),
stroke = 0.25,
interactive = FALSE,
do.identify = FALSE,
identify.ident = NULL,
do.hover = FALSE,
information = NULL
)

SpatialDimPlot(
object,
group.by = NULL,
images = NULL,
cols = NULL,
crop = TRUE,
cells.highlight = NULL,
cols.highlight = c("#DE2D26", "grey50"),
facet.highlight = FALSE,
label = FALSE,
label.size = 7,
label.color = "white",
repel = FALSE,
ncol = NULL,
combine = TRUE,
pt.size.factor = 1.6,
alpha = c(1, 1),
image.alpha = 1,
stroke = 0.25,
label.box = TRUE,
interactive = FALSE,
information = NULL
)

SpatialFeaturePlot(
object,
features,
images = NULL,
crop = TRUE,
slot = "data",
min.cutoff = NA,
max.cutoff = NA,
ncol = NULL,
combine = TRUE,
pt.size.factor = 1.6,
alpha = c(1, 1),
image.alpha = 1,
stroke = 0.25,
interactive = FALSE,
information = NULL
)

## Arguments

object A Seurat object Name of meta.data column to group the data by Name of the feature to visualize. Provide either group.by OR features, not both. Name of the images to use in the plot(s) 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 Adjust the opacity of the background images. Set to 0 to remove. Crop the plot in to focus on points plotted. Set to FALSE to show entire background image. If plotting a feature, which data slot to pull from (counts, data, or scale.data) 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') A list of character or numeric vectors of cells to highlight. If only one group of cells desired, can simply pass a vector instead of a list. If set, colors selected cells to the color(s) in cols.highlight A vector of colors to highlight the cells as; ordered the same as the groups in cells.highlight; last color corresponds to unselected cells. When highlighting certain groups of cells, split each group into its own plot Whether to label the clusters Sets the size of the labels Sets the color of the label text Whether to put a box around the label text (geom_text vs geom_label) Repels the labels to prevent overlap Number of columns if plotting multiple plots Combine plots into a single gg object; note that if TRUE; themeing will not work when plotting multiple features/groupings Scale the size of the spots. Controls opacity of spots. Provide as a vector specifying the min and max for SpatialFeaturePlot. For SpatialDimPlot, provide a single alpha value for each plot. Control the width of the border around the spots Launch an interactive SpatialDimPlot or SpatialFeaturePlot session, see ISpatialDimPlot or ISpatialFeaturePlot for more details DEPRECATED in favor of interactive DEPRECATED An optional dataframe or matrix of extra information to be displayed on hover

## Value

If do.identify, either a vector of cells selected or the object with selected cells set to the value of identify.ident (if set). Else, if do.hover, a plotly object with interactive graphics. Else, a ggplot object

## Examples

if (FALSE) {
# For functionality analagous to FeaturePlot
SpatialPlot(seurat.object, features = "MS4A1")
SpatialFeaturePlot(seurat.object, features = "MS4A1")

# For functionality analagous to DimPlot
SpatialPlot(seurat.object, group.by = "clusters")
SpatialDimPlot(seurat.object, group.by = "clusters")
}
{"ft_lang_label":"__label__en","ft_lang_prob":0.70810586,"math_prob":0.9929354,"size":4249,"snap":"2021-43-2021-49","text_gpt3_token_len":1049,"char_repetition_ratio":0.13992932,"word_repetition_ratio":0.1628615,"special_character_ratio":0.25017652,"punctuation_ratio":0.21311475,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.96479446,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-12-01T01:18:59Z\",\"WARC-Record-ID\":\"<urn:uuid:667895a6-39cd-40d7-a7b3-b2f474c9d481>\",\"Content-Length\":\"18194\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e1922bc9-b874-454b-8265-7b510be0ed23>\",\"WARC-Concurrent-To\":\"<urn:uuid:e24021b4-07a3-4605-b5ff-aa183a391031>\",\"WARC-IP-Address\":\"75.2.60.5\",\"WARC-Target-URI\":\"https://satijalab.org/seurat/reference/spatialplot\",\"WARC-Payload-Digest\":\"sha1:R7BKNENEOU43BPKPJ6LQQLI7TDBDNXR2\",\"WARC-Block-Digest\":\"sha1:6ELSA6JWTFHJENEB4E45LTFQBP36YH65\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-49/CC-MAIN-2021-49_segments_1637964359082.76_warc_CC-MAIN-20211130232232-20211201022232-00458.warc.gz\"}"}