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
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
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/
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 .
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.
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")
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
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.
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?
The parameters suggest by Jean-Karim will be those you need. Probably increasing cellheight, possibly also reducing fontsize_rows a bit.