[BioC] Heatmap.2 color scheme

Jeff Lande land0038 at umn.edu
Tue Mar 28 00:13:04 CEST 2006


Thanks Sean,

Initially I received the error

"Error in image.default(1:nc, 1:nr, x, xlim = 0.5 + c(0, nc), ylim = 0.5 +
: 
        must have one more break than colour"

when I included breaks = seq(-3,3,0.1), but I changed it to breaks =
seq(-4,4,0.03125) to cover the 256 colors and it worked very nicely.

Jeff

-----Original Message-----
From: Sean Davis [mailto:sdavis2 at mail.nih.gov] 
Sent: Monday, March 27, 2006 3:46 PM
To: Jeff Lande; Bioconductor
Subject: Re: [BioC] Heatmap.2 color scheme

Jeff,

You may want to have a look at the "breaks" argument to heatmap.2.  It will
allow you to set the number of breaks above and below zero to be equal so
that 0 is actually also the center of your color scale.  Using something
like breaks=seq(-3,3,0.1) is often helpful.

Sean

On 3/27/06 4:37 PM, "Jeff Lande" <land0038 at umn.edu> wrote:

>  
> 
> I find heatmap.2 to be a very nice dynamic tool for cluster visualization.
> I am having a little difficulty getting a good separation of colors in my
> heatmap and I'm not sure how to tweak it.
> 
>  
> 
> The accompanying color histogram in this package is a great feature.  My
> problem conceptually is that the distribution of colors is shifted to the
> left in the histogram.  I would like to revise the color scheme (or the
> data) so that the color distribution spans the middle of the histogram.
> I've played around using topo.colors(), heat.colors() and cm.colors(), but
> there seems to always be a "leftward" shift so that I'm only using the
> colors towards the left of the color vector.
> 
>  
> 
> Here is the code I am using to create the heatmap
> 
>  
> 
> --------------------------------------------------------------
> 
> hmcol <- colorRampPalette(brewer.pal(10, "RdBu"))(256)
> 
>  
> 
> spcol <- ifelse(alldata$ABScore > 1,"red","blue")
> 
>  
> 
> heatsub.2 <- function(myexprSet, genelist) {
> 
>  
> 
>       heatmap.2(exprs(myexprSet[genelist,]), col=hmcol,
ColSideColors=spcol,
> 
>             labRow=mget(genelist,hgu133aGENENAME),trace="none",
scale="row")
> 
> }
> 
>  
> 
> heatsub.2(alldata,mygenes[,1])
> 
> --------------------------------------------------------------
> 
>  
> 
> alldata is an exprSet and mygenes is the output from the pamr.listgenes
> command (mygenes[,1] is just a vector of probe sets significant by PAM).
> 
>  
> 
>  
> 
>> sessionInfo()
> 
> R version 2.2.1, 2005-12-20, i386-pc-mingw32
> 
>  
> 
> attached base packages:
> 
> [1] "tools"     "methods"   "stats"     "graphics"  "grDevices" "utils"
> "datasets"  "base"
> 
>  
> 
> other attached packages:
> 
>       gplots        gdata       gtools RColorBrewer         pamr
> hgu133a         affy      Biobase
> 
>      "2.3.0"      "2.1.2"      "2.2.3"      "0.2-3"     "1.28.0"
> "1.10.0"      "1.8.1"      "1.8.0"
> 
>> 
> 
>  
> 
> Any suggestions are appreciated.
> 
>  
> 
> Thanks,
> 
>  
> 
> Jeff Lande
> 
> Post-Doctoral Associate
> 
> University of Minnesota
> 
> 
> [[alternative HTML version deleted]]
> 
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor



More information about the Bioconductor mailing list