plotVisium {ggspavis}R Documentation

plotVisium

Description

Plots for spatially resolved transcriptomics data from the 10x Genomics Visium platform

Usage

plotVisium(
  spe,
  spots = TRUE,
  fill = NULL,
  highlight = NULL,
  facets = "sample_id",
  image = TRUE,
  assay = "logcounts",
  trans = "identity",
  x_coord = "x",
  y_coord = "y",
  y_reverse = TRUE,
  sample_ids = NULL,
  image_ids = NULL,
  palette = NULL
)

Arguments

spe

(SpatialExperiment) Input data object.

spots

(logical) Whether to display spots (spatial barcodes) as points. Default = TRUE.

fill

(character) Column in colData to use to fill points by color. If fill contains a numeric column (e.g. total UMI counts), a continuous color scale will be used. If fill contains a factor (e.g. cluster labels), a discrete color scale will be used. Default = NULL.

highlight

(character) Column in spatialData to use to highlight points by outlining them. For example, in_tissue will highlight spots overlapping with tissue. Default = NULL.

facets

(character) Column in colData to use to facet plots, i.e. show multiple panels of plots. Default = "sample_id". Set to NULL to disable.

image

(logical) Whether to show histology image as background. Default = TRUE.

assay

(character) Name of assay data to use when fill is in rownames(spe). Should be one of assayNames(spe).

trans

Transformation to apply for continuous scales. Ignored unless fill is numeric, e.g. feature expression. (See ggplot2{continuous_scale} for valid options.)

x_coord

(character) Column in spatialCoords containing x-coordinates. Default = "x".

y_coord

(character) Column in spatialCoords containing y-coordinates. Default = "y".

y_reverse

(logical) Whether to reverse y coordinates, which is often required for Visium data, depending on the orientation of the raw data. Default = TRUE.

sample_ids

(character) Samples to show, if multiple samples are available. Default = NULL (show all samples).

image_ids

(character) Images to show, if multiple images are available. Default = NULL (show all images).

palette

(character) Color palette for points. Options for discrete labels are "libd_layer_colors", "Okabe-Ito", or a custom vector of hex color codes. Options for continuous values are "viridis", a single color name (e.g. "red", "navy", etc), or a vector of length two containing color names for each end of the scale. Default = "libd_layer_colors" for discrete data, and "viridis" for continuous data.

Details

Function to generate plots for spatially resolved transcriptomics datasets from the 10x Genomics Visium spatially platform.

This function generates a plot for spot-based spatially resolved transcriptomics data from the 10x Genomics Visium platform, with several options available to adjust the plot type and style.

Value

Returns a ggplot object. Additional plot elements can be added as ggplot elements (e.g. title, customized formatting, etc).

Author(s)

Helena L. Crowell with modifications by Lukas M. Weber

Examples

library(STexampleData)

spe <- Visium_mouseCoronal()

# color by x coordinate, highlight in-tissue spots
plotVisium(spe, fill = "x", highlight = "in_tissue")

# subset in-tissue spots
sub <- spe[, as.logical(spatialData(spe)$in_tissue)]

# color by feature counts, don't include image
rownames(sub) <- make.names(rowData(sub)$gene_name)
plotVisium(sub, fill = "Gad2", assay = "counts")


[Package ggspavis version 0.99.7 Index]