plotSpots {ggspavis}R Documentation

plotSpots

Description

Plotting functions for spatially resolved transcriptomics data.

Usage

plotSpots(
  spe,
  x_coord = "x",
  y_coord = "y",
  in_tissue = "in_tissue",
  annotate = NULL,
  palette = "libd_layer_colors",
  y_reverse = TRUE,
  size = 0.3
)

Arguments

spe

(SpatialExperiment) Input data, assumed to be a SpatialExperiment object.

x_coord

(character) Name of column in spatialCoords containing x-coordinates. Default = "x".

y_coord

(character) Name of column in spatialCoords containing y-coordinates. Default = "y".

in_tissue

(character) Name of column in spatialData identifying spots over tissue, e.g. "in_tissue" for 10x Genomics Visium data. If this argument is provided, only spots over tissue will be shown. Alternatively, set to NULL to display all spots. Default = "in_tissue".

annotate

(character) Name of column in colData containing values to annotate spots with colors, e.g. cluster labels (discrete values) or total UMI counts (continuous values). For discrete values such as cluster labels, the column in colData should be formatted as a factor.

palette

(character) Color palette for annotation. Options for discrete labels (e.g. cluster labels) are "libd_layer_colors", "Okabe-Ito", or a vector of color names or hex values. For continuous values (e.g. total UMI counts), provide a vector of length 2 for the low and high range, e.g. c("gray90", "navy"). Default = "libd_layer_colors".

y_reverse

(logical) Whether to reverse y coordinates, which is often required for 10x Genomics Visium data. Default = TRUE.

size

(numeric) Point size for geom_point(). Default = 0.3.

Details

Function to plot spot-based spatially resolved transcriptomics data stored in a SpatialExperiment object.

This function generates a plot in spatial coordinates (e.g. x-y coordinates on a tissue slide), along with annotation such as cluster labels or total UMI counts.

Value

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

Examples

library(STexampleData)
spe <- Visium_humanDLPFC()
plotSpots(spe, annotate = "ground_truth")


[Package ggspavis version 0.99.7 Index]