[BioC] issue with color coding heatmaps for positive and negative values
Sean Davis
sdavis2 at mail.nih.gov
Wed Sep 5 18:58:42 CEST 2007
Mark W Kimpel wrote:
> 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)
Hi, Mark. You might look at the heatmap.2 function (in package gplots
on CRAN) and the breaks argument.
Sean
More information about the Bioconductor
mailing list