plotVisium | R Documentation |
Plots for spatially resolved transcriptomics data from the 10x Genomics Visium platform
plotVisium(
spe,
spots = TRUE,
annotate = NULL,
highlight = NULL,
facets = "sample_id",
image = TRUE,
zoom = FALSE,
show_axes = FALSE,
assay = "counts",
trans = "identity",
point_size = 1,
legend_position = "right",
x_coord = NULL,
y_coord = NULL,
y_reverse = TRUE,
sample_ids = NULL,
image_ids = NULL,
pal = NULL
)
spe |
(SpatialExperiment) Input data object. |
spots |
(logical) Whether to display spots (spatial barcodes) as points. Default = TRUE. |
annotate |
(character) Column in |
highlight |
(character) Column in |
facets |
(character) Column in |
image |
(logical) Whether to show histology image as background. Default = TRUE. |
zoom |
(logical) Whether to zoom to area of tissue containing spots. Default = FALSE |
show_axes |
(logical) Whether to show axes and coordinates. Default = FALSE |
assay |
(character) Name of assay data to use when |
trans |
Transformation to apply for continuous scales. Ignored unless
|
point_size |
(numeric) Point size. Default = 1. |
legend_position |
Legend position for annotations. Options are "left", "right", "top", "bottom", and "none". Default = "right". |
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). |
pal |
(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 and Yixing E. Dong
library(STexampleData)
spe <- Visium_mouseCoronal()
# color by x coordinate, highlight in-tissue spots
plotVisium(spe, annotate = "pxl_col_in_fullres", highlight = "in_tissue")
# subset in-tissue spots
sub <- spe[, as.logical(colData(spe)$in_tissue)]
# color by feature counts, don't include image
rownames(sub) <- make.names(rowData(sub)$gene_name)
plotVisium(sub, annotate = "Gad2", assay = "counts")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.