Skip to contents

Overlay selected features onto spatial images with improved color scales.

Usage

VisSpatialOverlay(
  object,
  features,
  image = NULL,
  coords_cols = c("x", "y"),
  palette = "C",
  point_size = 2,
  alpha = 0.5
)

Arguments

object

A Seurat object. If no spatial image present, falls back to embedding overlay.

features

Character vector of gene features; required.

image

Image key. Default: active image (NULL).

coords_cols

Column names for fallback coordinates in meta.data. Default: c("x","y").

palette

Viridis palette option for color/fill. Default: "C".

point_size

Point size for fallback scatter. Default: 2.

alpha

Point alpha. Default: 0.5.

Value

A patchwork of spatial feature plots or embedding overlays.

Author

benben-miao

Examples

obj <- SeuratVisProExample(
    n_cells = 300,
    n_genes = 1000,
    n_clusters = 10,
    seed = 123,
    genes_mt = "^MT-",
    neighbor_dims = 10,
    cluster_res = 0.5,
    umap_dims = 10,
    spatial = TRUE)
#> Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
#> 
#> Number of nodes: 300
#> Number of edges: 4508
#> 
#> Running Louvain algorithm...
#> Maximum modularity in 10 random starts: 0.9485
#> Number of communities: 10
#> Elapsed time: 0 seconds

p <- VisSpatialOverlay(
  obj,
  features = c("G1", "G2", "G3", "G4"),
  image = NULL,
  coords_cols = c("x", "y"),
  palette = "C",
  point_size = 2,
  alpha = 0.5)
p