DoHeatmap Seurat Edit Legend
1
0
Entering edit mode
22 months ago
mfro • 0

Hi Community

I am wondering how I can edit the Legend in a DoHeatmap which is a feature in Seurat. I want to get rid of the identity Legend but not the expression scale.

Is there a way of doing this?

Best Regards

Seurat Single-cell-sequencing R • 4.0k views
ADD COMMENT
2
Entering edit mode
22 months ago

Hi,

Seurat visualization is based (if not solely) in ggplot2 R package. Thus, in order to address your question you need to look into ggplot2 documentation and syntax.

Since you didn't provide any code sample neither figure, I provide below a minimal reproducible code attempting to generate the figure that you're looking for.

# Packages 
library("dplyr")
library("Seurat")
#library("SeuratData")

# Install, load data & run Seurat upstream workflow
SeuratData::InstallData("ifnb")
ifnb <- SeuratData::LoadData("ifnb")
ifnb <- ifnb %>% 
  NormalizeData(.) %>% 
  FindVariableFeatures(., selection.method = "vst", nfeatures = 2000) %>% 
  ScaleData(.)

# Plot heatmap
set.seed(123)
DoHeatmap(ifnb, features = VariableFeatures(ifnb)[1:100], 
          cells = sample(1:ncol(ifnb), 500), size = 4,
          angle = 90) + guides(color="none")

The trick is done with guides(color="none"). The result is the following plot:

enter image description here

I hope this helps,

António

ADD COMMENT
0
Entering edit mode

Thank you so much antonioggsousa ! That is exactly what I wanted.

Cheers Marvin

ADD REPLY

Login before adding your answer.

Traffic: 1729 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6