plotSpots | R Documentation |
Plotting functions for spatial transcriptomics data.
plotSpots(
spe,
x_coord = NULL,
y_coord = NULL,
sample_id = NULL,
in_tissue = "in_tissue",
annotate = NULL,
feature_names = NULL,
assay_name = "counts",
pal = NULL,
point_size = 0.3,
legend_position = "right",
legend_point_size = 3,
show_axes = FALSE,
y_reverse = TRUE,
text_by = NULL,
text_by_size = 5,
text_by_color = "black"
)
spe |
Input data, assumed to be a |
x_coord |
Name of column in |
y_coord |
Name of column in |
sample_id |
Name of column in |
in_tissue |
Name of column in |
annotate |
Variable to show as annotations. This may be discrete or
continuous. For a discrete variable (e.g. cluster labels), this should be
the name of a column in |
feature_names |
Name of column in |
assay_name |
Name of |
pal |
Color palette for annotations. Options for discrete values are "libd_layer_colors", "Okabe-Ito", or any vector of color names or hex values. For continuous values, provide a vector of length 2 for the low and high range, e.g. c("gray90", "navy"). |
point_size |
Point size. Default = 0.3. |
legend_position |
Legend position for discrete annotations. Options are "left", "right", "top", "bottom", and "none". Default = "right". |
legend_point_size |
Legend point size for discrete annotations. Default = 3. |
show_axes |
Whether to show axis titles, text, and ticks. Default = FALSE. |
y_reverse |
Whether to reverse y coordinates. This is usually required for 10x Genomics Visium datasets when using the default coordinate values. Default = TRUE. Set to FALSE if not needed, e.g. for other platforms. |
text_by |
Column name of annotation labels to display over each cluster
of points. This will usually be the same as |
text_by_size |
Text size for annotation labels over each cluster. Default = 5. |
text_by_color |
Color name or hex code for annotation labels. Default = "black". |
Function to create spot plot showing spatial locations in x-y coordinates with optional annotations such as cluster labels, expression of a gene, or quality control metrics.
Returns a ggplot object, which may be further modified using ggplot functions.
Lukas M. Weber and Yixing E. Dong
library(STexampleData)
# discrete annotations
spe <- Visium_humanDLPFC()
plotSpots(spe, annotate = "ground_truth")
# continuous annotations
spe <- Visium_mouseCoronal()
plotSpots(spe, annotate = "Gapdh", feature_names = "gene_name")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.