heatmap resolution issue
2
0
Entering edit mode
7.3 years ago
1769mkc ★ 1.2k

My heatmap

I am getting the heatmap but the gene list look pretty crowded and cluttered no of genes = 242 .Is there a way where I can make the plot more legible ,I'm using pheatmap

Any suggestion or help is highly appreciated

R • 3.6k views
ADD COMMENT
1
Entering edit mode

I wonder if it's informative to have a list of 242 genes there, nobody is going to read all of those anyway. You should think about which message your heatmap should send.

ADD REPLY
0
Entering edit mode

well true but i just wanted to see how it looks like i will certainly trim it down ,but is it possible to make it more legible?

ADD REPLY
1
Entering edit mode

The parameters suggest by Jean-Karim will be those you need. Probably increasing cellheight, possibly also reducing fontsize_rows a bit.

ADD REPLY
6
Entering edit mode
7.2 years ago
EagleEye 7.5k

Small suggestion: To make this heatmap look pretty

I can see that you got positive and negative values in your heatmap. Use breaks to differentiate positive and negative values. Also instead of using default color scale, use different colors.

Example: (Adjust according to your data), for color codes mention below refer.

mycol=c("#08088A","#0404B4","#0000FF","#2E2EFE","#8181F7","white","#FFBF00","#DBA901","#B18904","#886A08","#5F4C0B")

bk = unique(c(seq(max(mymatrix),1, length=5),0,rev(seq(min(mymatrix),-1, length=5))))

pheatmap(mymatrix,show_rownames=T,col=mycol,breaks=bk,cluster_cols=T,cluster_rows=T,cex=0.5)

Note: If you do not want to struggle for choosing colors use 'library(RColorBrewer)' Palette's. Example: colorRampPalette(brewer.pal(9, "RdBu"))(100) , http://simplystatistics.org/2011/10/17/colors-in-r/

ADD COMMENT
0
Entering edit mode

I used your code and the heatmap looks really good but I have very fundamental question can you explain me what does each of the code means

bk = unique(c(seq(max(mymatrix),1, length=5),0,rev(seq(min(mymatrix),-1, length=5))))

unique(c(seq(max(mymatrix),1, length=5),0,rev(seq(min(mymatrix),-1, length=5))))

the whole code what , i'm bit confused with the code when im changing the parameters such as length the heatmap changes totally . So i would be glad if you can let me know what does each of the code is doing , now my fonts that depicts my sample are really tiny ,can you suggest some thing more so that those fonts can get big at least the name that depicts the column .

ADD REPLY
2
Entering edit mode

You break your values in different bins c(max,0,min). Lets assume you have minimum value (-10), maximum value (+10), then the range of data will be [10,0,-10]. Now you want to assign gradient of colors for your range of data, for that you split your values in different bins, eg. 5 on each side of negative and positive with ZERO in the middle [10,7,5,3,1,0,-1,-3,-5,-7,-10] and assume colors for each bin ["#08088A","#0404B4","#0000FF","#2E2EFE","#8181F7","white","#FFBF00","#DBA901","#B18904","#886A08","#5F4C0B"]

make breaks or bins

bk = unique(c(seq(max(YOUR_DATA_MATRIX),1, length=5),0,rev(seq(min(mymatrix),-1, length=5)))) OR

bk = unique(c(seq(max(YOUR_DATA_MATRIX),1, length=5),0,seq(-1,min(YOUR_DATA_MATRIX), length=5)))

Assign colors

mycol=c("#08088A","#0404B4","#0000FF","#2E2EFE","#8181F7","white","#FFBF00","#DBA901","#B18904","#886A08","#5F4C0B")

For font adjust 'cex=' value.

ADD REPLY
0
Entering edit mode

thank you very much for the explanation

ADD REPLY
0
Entering edit mode

One more thing to ask it seems that the default pheatmap uses its own clustering method ,can I use a different clustering method like euclidean , can i provide the argument itself in the pheatmap it self or I have to calculate it differently?

ADD REPLY
1
Entering edit mode

You can use these parameters inside pheatmap

clustering_distance_rows = "euclidean", clustering_distance_cols = "euclidean", clustering_method = "complete"

Here are the other available optiona.

ADD REPLY
0
Entering edit mode

color = colorRampPalette(c("navy", "white", "firebrick3"))(50), so in this code I define the number (50) which basically increases the color gradient , how can i do the same with the your code

mycol=c("#08088A","#0404B4","#0000FF","#2E2EFE","#8181F7","white","#FFBF00","#DBA901","#B18904","#886A08","#5F4C0B")
ADD REPLY
0
Entering edit mode

I found you simple example here, you can use this as reference for your data.

ADD REPLY
4
Entering edit mode
7.3 years ago

Have you tried playing with parameters cellwidth, cellheight, fontzise, fontsize_row and fontsize_col ?

ADD COMMENT
0
Entering edit mode

no i haven't used all those parameters , i will give it a try

ADD REPLY

Login before adding your answer.

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