[R] heatmap with levelplot

Antje niederlein-rstat at yahoo.de
Mon Jan 26 10:31:29 CET 2009


Hi there,

I'd like to create a heatmap from my matrix with
a) a defined color range (lets say from yellow to red)
b) using striking colors above and below a certain threshold (above = "green", 
below = "blue")

Example matrix (there should be a few outliers generated...) + simple levelplot 
without outliers marked:

library(lattice)
my.mat <- matrix(rnorm(800), nrow = 40)
threshold <- c(-1,1) # should be used for the extreme colors
colorFun <- colorRampPalette(c("yellow","red"))
levelplot(my.mat, col.regions = colorFun(50))


I don't know how to handle the extrem values...

Can anybody help?

Antje




More information about the R-help mailing list