[BioC] issue with color coding heatmaps for positive and negative values

Wolfgang Huber huber at ebi.ac.uk
Thu Sep 6 00:00:06 CEST 2007


Dear Mark,

Also, the "latticeExtra" package allows to construct very nice heatmaps 
- see the examples for dendrogramGrob.

  Best wishes
   Wolfgang


> I would like to "hard code" the colors to be used with certain ranges of 
> values for a heatmap. The issue has occurred because I have discovered 
> than, in a special case of mine, positive numbers are not always yellow 
> and negative numbers are not always blue. Below is an extreme example 
> which demonstrates this behavior. The issue occurs regardless of whether 
> scale="none" or scale="row" is used as an argument.
> 
> Is there a workaround such that I can use one scale for positive numbers 
> and another scale for negatives?
> 
> Thanks,
> Mark
> 
> a <- c(rep(c(-100, -9, -8, -11), 5), -2, 4)
> a.mat <- matrix(rep(a, 50), byrow=TRUE, nrow=50)
> require(RColorBrewer)
> BlYl <- c('#0061FF', '#0A0780','#9D8F00', '#FFF200')
> hmcol <- colorRampPalette(BlYl, space = "rgb")(128)
> heatmap(a.mat, col=hmcol)



More information about the Bioconductor mailing list