Home > Enterprise >  How to Include Legend in Seurat DimHeatmap function
How to Include Legend in Seurat DimHeatmap function

Time:07-01

Is there a general way to include legends in Seurat graphs? For example, if my code is,

DimHeatmap(norm_data3, dims = 1, cells = 500, balanced = TRUE)

how can I include a legend with color corresponding to value of PCA component?

CodePudding user response:

It is a bit vague, but you should set fast = FALSE:

If true, use image to generate plots; faster than using ggplot2, but not customizable

Here is a reproducible example using the pbmc_small dataset from the Seurat pacakage:

library(Seurat)
#> Warning: package 'Seurat' was built under R version 4.1.2
#> Attaching SeuratObject
#> Attaching sp
data("pbmc_small")
DimHeatmap(pbmc_small, dims = 1, cells = 500, balanced = TRUE, nfeatures = 4, fast = FALSE)
#> Warning: Requested number is larger than the number of available items (80).
#> Setting to 80.

Created on 2022-06-30 by the reprex package (v2.0.1)

  • Related