[R] heatmap with levelplot?

Deepayan Sarkar deepayan.sarkar at gmail.com
Fri Dec 22 21:16:50 CET 2006


On 12/22/06, Yuli Zhou <yul.zhou at gmail.com> wrote:
> Hi,
>
> How do I anchor z=0 to the white color in a levelplot so that
> the color changes from cyan to magenta precisely as
> z changes from negative to positive?

The changepoints are defined by 'at', and the colors are chosen more
or less linearly, so you need to make sure 0 is near the center of
your 'at'. E.g.

levelplot(cor(mtcars), at = seq(-1.01, 1.01, length = 20))


> Also is it easy to change
> color scheme, say to blue/red as it's more dramatic?

Sure, e.g.

bluered = colorRampPalette(c("red", "white", "blue"), space = "Lab")
levelplot(volcano, col.regions = bluered(100), cuts = 99)


> Is there a
> better function for showing heatmap with a color bar?
>
> Thanks in advance for any help, I've played with image,
> heatmap and levelplot a little and haven't gotten very far.
>
> Yuli Zhou
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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