[R] Heatmap without levelplot

Dieter Menne dieter.menne at menne-biomed.de
Tue May 5 12:23:11 CEST 2009


Antje <niederlein-rstat <at> yahoo.de> writes:

> as I'm not sure to understand the coloring levelplot uses, I'm looking for 
> another easy way to create a heatmap like this:
> 
> library(lattice)
> mat <- matrix(seq(1,5, length.out = 12), nrow = 3)
> mat[1,2] <- 3.5
> 
> my.at <- seq(0.5,5.5, length.out = 6)
> my.col.regions <- rainbow(5)
> 
> graph <- levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = 
> my.col.regions)
> print(graph)
> 

Looks fine to me, so what's wrong? Maybe have a look at RColorBrewer
to get more pleasing colors.

Dieter




More information about the R-help mailing list