How to Remove Sample Names from Heatmap
1
0
Entering edit mode
20 months ago
Storm • 0

Hi there,

I constructed a heatmap to display the results of my differential expression analysis through the Heatmap function from the ComplexHeatmap package. As I have many samples (400+) the sample names are unreadable and therefore I would just like to remove them so the visualization is a bit easier to understand. Is there a way to just get rid of the sample names, I tried a few different things like setting show_row_ names = false but it didn't change anything. I have attached an image for how it looks right nowenter image description here

Heatmap ComplexHeatmap • 2.2k views
ADD COMMENT
4
Entering edit mode

use show_column_names = FALSE

ADD REPLY
0
Entering edit mode

enter image description hereThank you! It now shows up like this, do you know how I can get the gene names to appear on the right side cleanly? There are only 20 genes so I want to make it readable. Removing the numbers might help, I think those show the expression value but not sure

ADD REPLY
4
Entering edit mode

Try:

png("test.png", width=12, height = 4, units="in",res=300)
Your heatmap code here......
dev.off()

Change width and height to get the plot appropriately

ADD REPLY
0
Entering edit mode

Thank you. I adjusted the dimensions and it makes it look better. However, on the right side, the gene symbol seems to be overlapping with the number. Is this due to a setting, I can't seem to fix it by adjusting the dimensions.

ADD REPLY
5
Entering edit mode
20 months ago
DareDevil ★ 4.3k

Try the following way

mat = matrix(rnorm(80, 2), 8, 10)
mat = rbind(mat, matrix(rnorm(40, -2), 4, 10))
rownames(mat) = letters[1:12]
colnames(mat) = letters[1:10]

Then

Heatmap(mat, show_column_names = FALSE)

output

To save the plot:

png("heatmap_test.png", width=12, height = 4, units="in", res=300)
Heatmap(mat, show_column_names = FALSE)
dev.off()

or

 png("heatmap_test.png", width=12, height = 4, units="in", res=300)
 ht <- Heatmap(mat, show_column_names = FALSE)
 draw(ht)
 dev.off()
ADD COMMENT

Login before adding your answer.

Traffic: 1478 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