How to Remove Sample Names from Heatmap
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 now
• 5,050 views
•
link
1 answer
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)
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()
• 0 views
•
link
Log in to answer this question.
use
show_column_names = FALSETry:
Change
widthandheightto get the plot appropriatelyThank 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.