[R] heatmap.2() yielding an inappropriate key?

Karl Brand k.brand at erasmusmc.nl
Mon Jul 19 12:42:58 CEST 2010


Esteemed R-users,

heatmap.2() is yielding an inappropriate key based on my colors and 
break-points.

In the reproducible example below, the key is inappropriate (to me) because-

1. 'Orange' is simply not represented in the key, despite its prescence 
in the heatmap.
2. The proportions of the key are clearly out, ie., my largest bin, (0.1 
- 0.2) is half the range, but this bin (colored "gray") clearly extnds 
bellow the "0.1" tick mark of the key, beyond its specified bin.

What am i missing/doing wrong? Or for a key set up like this example is 
heatmap.2() unsuitable, necessitating production with another graphics 
functions? If so, recommendations appreciated. I have tried ggplot2, but 
struggle getting this function producing what i need. And i just need to 
make a nice key at this point.

All thoughts and suggestions greatly appreciated.
cheers,

karl


#reproducible example:
library(gplots)
set.seed(5)
mat <- matrix(runif(50,  min=0, max=0.2), nrow = 10, ncol = 5)
heatmap.2(mat,
           Rowv=NULL, Colv=NULL,
           col = c(heat.colors(4, alpha = 1), "gray"),
           breaks = c(0, 0.01, 0.05, 0.075, 0.1, 1),
           trace = "none",
           dendrogram = "none",
           density.info = "none",
           margins=c(12, 8))

-- 
Karl Brand <k.brand at erasmusmc.nl>
Department of Genetics
Erasmus MC
Dr Molewaterplein 50
3015 GE Rotterdam
P +31 (0)10 704 3409 | F +31 (0)10 704 4743 | M +31 (0)642 777 268



More information about the R-help mailing list