the entries of the matrix is the correlation value and I don't scale it. I did with column (which was wrong and I tried without scaling, the plot more or less was the same)/
How to make heatmap more bright with proper color spectrum ?
Hi,
I need to create heatmap with bright colors which different values have different colors. all the enteris of my matrix is between -0.1- 0.9.
I have tried the following command, but the heatmap is not interesting. How can I make it nice with more colors such that the different values have different colors?
Here is my command :
heatmap.2(Gene, col=greenred(10), key=TRUE, symkey=FALSE, symm=F,symbreaks=T,cexRow=1,cexCol=1,margins=c(6,11), scale= "column" ,trace="none",srtCol=45)
dev.off()
Here is the image :

• 10,129 views
•
link
2 answers
• 0 views
•
link
The problem is with your range of values that's why on the either ways to zero its 1;9 and then you scale columns, try with scaling rows and add breaks in your heatmap command as;
breaks=c(-0.1,0,0.2,0.3,0.4,0.5,0.6,0.7,0,8,0.9)
or better to plot a heatmap of z-score and use colors from RColorBrewer
e.g. I would do in this way
library(gplots)
library(RColorBrewer)
hr <- hclust(as.dist(1-cor(t(Gene), method="pearson")), method="average");
hc <- hclust(as.dist(1-cor(Gene, method="spearman")), method="average")
# Cuts the tree and creates color vector for clusters.
mycl <- cutree(hr,k=4, h=max(hr$height)/1.5);
mycolhc <- rainbow(length(unique(mycl)), start=0.1, end=0.9)
mycolhc <- mycolhc[as.vector(mycl)] ; myheatcol <- bluered(75)
heatmap.2(as.matrix(Gene), Colv=as.dendrogram(hc),
col=myheatcol, scale="row", density.info="none",
trace="none", RowSideColors=mycolhc,cexRow=1.5,
cexCol=1.5, keysize=1,margins=c(20,10))
hth
• 0 views
•
link
Log in to answer this question.
Have you tried
rainbow()instead ofgreenred()?BTW, linking to an image in your gmail inbox won't work. You need to post it somewhere and then link to it there. Well, unless you want to give us your email login details, but that's a bad idea...
i thought that I have copeid inot the post. well, where can I upload image ?
Imgur, tinypic, postimage, etc. Just google "free image hosting" for more sites than you could ever need.
I updated the post.
What about
scale = "row"? Assuming rows represent different genes the heatmap just highlights most abundant genes whenscale = "column".