[R] color palette heatmap

Achim Zeileis Achim.Zeileis at uibk.ac.at
Wed Feb 10 22:39:38 CET 2010


On Wed, 10 Feb 2010, joonR wrote:

>
> Hi,
> I'm kinda new of the R world.
> I need to use the heatmap or heatmap.2 function to plot correlation values.
>
> 2 questions:
> - how can I specify a color palette? (would like to have a transition from
> blue(-1) to white(0) to red(1))

In example(heatmap.2), there is an example for a blue-white-red scale 
using the bluered() function from gplots.

bluered() does its transitions in RGB space which is typically suboptimal. 
A better approach is to do it in HCL space, e.g., as the diverge_hcl() 
function from "colorspace" does. For example:

   heatmap.2(as.matrix(mtcars), col = diverge_hcl(11),
     scale="column", tracecol = NULL)

> - how can I use heatmap.2 imposing a specific order (like hclust.order)?
>  I mean, I don't want heatmap.2 to re-cluster/re-order my data but just to
> plot them according to a specified (by me) order (I tried Rowv = hc$order
> where hc is an hclust object, but without success)

Someone else will have to help here...sorry.

hth,
Z

> can you help me?
>
> Thanks a lot!
>
> J
>
>
> -- 
> View this message in context: http://n4.nabble.com/color-palette-heatmap-tp1476296p1476296.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