0
votes

I'm creating a heatmap using heatmap.2 and had a question about the scale of the colour key. I have applied log10 to my data and have some negative values. However, the colour key is scaled between 0 and 0.3. Where did this scale come from?

library(gplots)
scalewhitered <- colorRampPalette(c("white", "red"), space = "rgb")(255)
heatmap.2(as.matrix(log10_normalised),Rowv=T, Colv=F,scale="none",     trace="none",labRow=rownames(log10_normalised), col=scalewhitered, xlab="", ylab="", mar=c(10,10))

Is it possible to make all the 0 values white and then show the non-zero numbers (including the negatives) as different shades of red? Thanks so much.

1

1 Answers

0
votes

The idea here is to create your own color scale (basically you have to define the ranges for the colors). You can use the colorRampPalette from the RColorBrewer package:

http://cran.r-project.org/web/packages/RColorBrewer/

Take a look at the following link where they found a solution of how to do it:

How to change heatmap.2 color range in R?