[R] heatmap

threshold r.kozarski at gmail.com
Tue Oct 18 16:28:04 CEST 2011


Dear R users, need help with my heatmap. I will really approciate some help.

Given the matrix:
> head(x)
      A   B C D time
[1,]  0   8 0 0    1
[2,]  0 160 0 0    2
[3,]  0 175 0 0    3
[4,]  0 253 0 0    4
[5,] 79 212 0 0    5
[6,]  6 105 0 0    6

and call:

##------------ Heatmap --------------

library(RColorBrewer)
rc <- grey((nrow(x):1)/nrow(x))
heatmap(data.matrix(x[,1:4]), Rowv=NA, Colv=NA, scale='none',labCol=NULL,
revC=TRUE, col = brewer.pal(9,'Greys'),
        ylab='time',margins=c(6,5), cexRow=1.5, cexCol=1.5, RowSideColors =
rc)

I end up with something like attached 'heatmap'.

How can I change my call to:
1) most important: there are black strips on the right-hand side, these are
the row numbers packed one on another. How to put there time points over,
say, 500 sec epochs (1,500, 1000...)
2) put a scale on the colour key on the left-hand side, and replace the
whole key on the right-hand side
3) have 'A'B'C'D' labels in horizontal orientation; replace 'time' label on
the left side
4) put frame around the plot


##----------------- Heatmap2 -----------------
I did not try with ggplot, but tried with 'heatmap.2':

heatmap.2(data.matrix(x[,1:4]), Rowv=NA, Colv=NA, dendrogram='none',
scale='none', labRow=FALSE, cexRow=1,cexCol=1,
          col = brewer.pal(9,'Greys'), density.info='none', key.size=1,
trace='none')

and got heatmap2 attached
if heatmap.2 is something you suggest, then the same questions apply + one
more:

5) how to change 'Color Key' label and put it along the rows

Best, robert


http://r.789695.n4.nabble.com/file/n3915575/heatmap.png 
http://r.789695.n4.nabble.com/file/n3915575/heatmap2.png 

--
View this message in context: http://r.789695.n4.nabble.com/heatmap-tp3915575p3915575.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list