Question: heatmap resolution issue
0
gravatar for krushnach80
22 months ago by
krushnach80420
krushnach80420 wrote:

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 • 1.1k views
ADD COMMENTlink modified 21 months ago by EagleEye5.9k • written 22 months ago by krushnach80420
1

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 REPLYlink written 22 months ago by WouterDeCoster34k

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 REPLYlink written 22 months ago by krushnach80420
1

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

ADD REPLYlink written 22 months ago by WouterDeCoster34k
6
gravatar for EagleEye
21 months ago by
EagleEye5.9k
Sweden
EagleEye5.9k wrote:

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 COMMENTlink modified 21 months ago • written 21 months ago by EagleEye5.9k

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 REPLYlink modified 21 months ago • written 21 months ago by krushnach80420
2

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 REPLYlink modified 21 months ago • written 21 months ago by EagleEye5.9k

thank you very much for the explanation

ADD REPLYlink written 21 months ago by krushnach80420

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 REPLYlink written 21 months ago by krushnach80420
1

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 REPLYlink written 21 months ago by EagleEye5.9k

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 REPLYlink written 21 months ago by krushnach80420

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

ADD REPLYlink written 21 months ago by EagleEye5.9k
4
gravatar for Jean-Karim Heriche
22 months ago by
EMBL Heidelberg, Germany
Jean-Karim Heriche17k wrote:

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

ADD COMMENTlink written 22 months ago by Jean-Karim Heriche17k

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

ADD REPLYlink written 22 months ago by krushnach80420
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 711 users visited in the last hour