[R] heatmap.2 - ColSideColors question

Rainer Machne raim at tbi.univie.ac.at
Tue Mar 16 16:18:38 CET 2010


On 03/16/2010 04:06 PM, Tim Smith wrote:
> Hi,
> 
> I wanted to make more than one side color bar. 

The function heatmap.plus (library: heatmap.plus) can do that, just
combine the different color vectors with cbind(col1,col2). Unfortunately
the arguments required for heatmap, heatmap.2 and heatmap.plus are
slightly different.

r




For example, I can make one side color bar (col1) with the following code:
> -----------------------------------
> library(gplots)
> 
> mat <- matrix(sample(1:100,40),nrow=5)
> class1 <- c(rep(0,4),rep(1,4))
> col1 <- ifelse(class1 == 0,"blue","red")
> class2 <- c(rep(1,3),rep(2,5))
> col2 <- ifelse(class2 == 0,"yellow","green")
> 
> heatmap.2(mat,col=greenred(75),ColSideColors=col1,trace="none",
>           dendrogram = "column",labCol = NULL)
> 
> 
> -----------------------------------
> How can I modify the code so that both col1 & col2 are displayed in the heatmap? 
> thanks!
> 
> 
>       
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list