
Plot multiple features on a single embedding
PlotMultiFeature.RdOverlays several genes onto one UMAP / tSNE / PCA plot, coloring cells by which gene they express above a threshold. Three modes are available:
Usage
PlotMultiFeature(
seurat_object,
features,
colors = NULL,
null_color = "gray70",
threshold = 0.0125,
plot_mode = c("gene", "intersection", "scale"),
pct_cutoff = 0.3,
intersection_label = "Co-expressing",
assay = "RNA",
layer = "data",
reduction = "umap",
pt.size = 0.5,
alpha = 0.9,
shape = 16,
title = NULL,
subtitle = NULL,
legend_title = "Gene",
show_legend = TRUE,
output_dir = NULL,
object_name = "",
subset_name = "",
file_name = NULL,
width = NULL,
height = NULL,
timestamp = FALSE
)Arguments
- seurat_object
A Seurat object (v3 or v5).
- features
Character vector of gene names to visualize.
- colors
Named or unnamed character vector of colors (one per gene). Auto-filled from
Nour_pal("all")for missing entries. IfNULL, the fullNour_pal("all")palette is used.- null_color
Color for cells that express no gene above threshold. Default
"gray70".- threshold
Numeric scalar, or named numeric vector (names = gene names), giving the minimum expression value for a cell to be considered positive. Default
0.0125.- plot_mode
One of
"gene"(default),"intersection", or"scale".- pct_cutoff
For
plot_mode = "intersection": the fraction of the gene list a cell must express to count as co-expressing. Default0.3(i.e. >= 30% of genes).- intersection_label
Label shown in the legend for co-expressing cells. Default
"Co-expressing".- assay
Assay to pull expression from. Default
"RNA".- layer
Layer / slot to pull (Seurat v5 layer name or v3 slot name). Default
"data".- reduction
Dimensional reduction to use for coordinates. Default
"umap".- pt.size
Point size. Default
0.5.- alpha
Point transparency
[0, 1]. Default0.9.- shape
ggplot2 point shape integer. Default
16(filled circle).- title
Plot title. Default
NULL.- subtitle
Plot subtitle. Default
NULL.- legend_title
Legend title. Default
"Gene".- show_legend
Logical; show color legend? Default
TRUE.- output_dir
Directory to save a PDF. If
NULL(default) the plot is printed to the active graphics device.- object_name
Optional prefix used when building the output file name.
- subset_name
Optional second prefix for the output file name.
- file_name
Character or
NULL. Base name (no extension) for the saved PDF.NULL(default) auto-deduces fromobject_name,subset_name, and the first few gene names.- width, height
Numeric or
NULL. Override the saved PDF dimensions in inches.NULL(default) uses a fixed 6 x 5 in panel.- timestamp
Logical. When
TRUE, append a_YYYYMMDD-HHMMSSstamp to the saved file name so repeated runs are versioned instead of overwriting the previous PDF. DefaultFALSE.
Details
- "gene" (default)
Each cell is colored by the last gene in
featuresthat it expresses above threshold (later genes overwrite earlier ones for multi-expressing cells). Cells below all thresholds are drawn innull_color.- "intersection"
Cells that express at least
pct_cutoff× n_genes genes are highlighted as co-expressing. All others arenull_color.- "scale"
Continuous color gradient showing expression level of a single gene (
features[1]only).