[R] Help with levelplot color assignment in lattice

sguyader sguyader at gmail.com
Mon Aug 29 14:46:25 CEST 2011


Hi,

Thank you Duncan, you showed me how to assign a specific color NA values in
the levelplot. However, I'm still not satisfied with the result of the code
you provided. In the data frame I provided in the first post, there's one
plant with level=0 (at x=8, y=1), and many other plants have level=1. In the
resulting levelplot, levels 0 and 1 all get the same color (white) whereas I
expected level=0 to get white color, and level=1 to get the next color.
Also, in your code, one color is missing, there should be 10 colors for
levels 0 to 9, plus "black" for NA=10 value. But even adding an extra color,
I can't get the right result. 
In fact, it looks like the problem I have is in the way levelplot assigns
colors: they seem to be assigned between level values, instead of being
centered on thes values. There is probably a way of changing that, but so
far I've had no sucess. I think I don't really deeply understand how
levelplot works.

-Sebastien

--
View this message in context: http://r.789695.n4.nabble.com/Help-with-levelplot-color-assignment-in-lattice-tp3774374p3776131.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list