plotVisium {ggspavis} | R Documentation |
Plots for spatially resolved transcriptomics data from the 10x Genomics Visium platform
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 )
spe |
(SpatialExperiment) Input data object. |
spots |
(logical) Whether to display spots (spatial barcodes) as points. Default = TRUE. |
fill |
(character) Column in |
highlight |
(character) Column in |
facets |
(character) Column in |
image |
(logical) Whether to show histology image as background. Default = TRUE. |
assay |
(character) Name of assay data to use when |
trans |
Transformation to apply for continuous scales. Ignored unless
|
x_coord |
(character) Column in |
y_coord |
(character) Column in |
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. |
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.
Returns a ggplot object. Additional plot elements can be added as ggplot elements (e.g. title, customized formatting, etc).
Helena L. Crowell with modifications by Lukas M. Weber
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")