[R] Specific criteria for color palette using heatmap.2

Schalk Heunis schalk.heunis at gmail.com
Mon Sep 21 14:55:44 CEST 2009


I think this is what you want, using the volcano dataset as an example:
> data(volcano)
> heatmap.2(volcano / max(volcano), col=c(heat.colors(16)[1:15],"black"))

Basically, setting the last color to be black.  If you want better
control over exactly what range should be black, you can set the
breaks property.

> breaks <- c(seq(0, 1-1e-10, length=16) ,1)
> heatmap.2(volcano / max(volcano), col=c(heat.colors(16)[1:15],"black"), breaks = breaks)

HTH
Schalk Heunis



On Mon, Sep 21, 2009 at 1:43 PM, bioinformatics_guy
<wwwhitener at gmail.com> wrote:
>
> I'm trying to display the probability space of a function and wanted to see
> specifically where the maximum posterior probability is.
>
> data=read.table("PosteriorData",header=F)
> mat=as.matrix(data)
> heatmap.2(mat/max(mat,na.rm=T),dendrogram=c("none"),trace=c("none"),
>
> Rowv=F,Colv=F,labRow=3*c(10:-10),labCol=3*c(-10:10),symm=T,col=rainbow(100))
>
> As the values are largely dispersed, I proportioned them to the maximum
> posterior value (matrix/max value matrix) so that the max value would be 1.
> I'd like this point to show up as say black on my heatmap.  Is there a way I
> can do this?  Set value=1 as black or yellow or whatever?
>
> --
> View this message in context: http://www.nabble.com/Specific-criteria-for-color-palette-using-heatmap.2-tp25530297p25530297.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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