[R] levelplot question

Antje niederlein-rstat at yahoo.de
Tue May 5 09:00:26 CEST 2009


Hi Greg and all the others,

thanks for your answer. The color-vector has the same length like the at-vector 
but the recycling cannot be the reason, because only values slightly above my 
"threshold" doe not appear blue.
I cannot find a good explanation of which colors are assigned to which value 
ranges.

I've made little example:

#--------------------------------------------------------
mat <- matrix(seq(1,5, length.out = 12), nrow = 3)
mat[1,2] <- 3.5

my.at <- seq(0.5,5.5)
my.col.regions <- rainbow(6)

graph <- levelplot(t(mat[nrow(mat):1, ] ), at = my.at, col.regions = 
my.col.regions)
print(graph)

windows()
plot(1:10)
legend("topleft", legend = as.character(my.col.regions), col = my.col.regions, 
pch = 18)
#--------------------------------------------------------

As you can see the green (position 3 in my.col.regions) disappears completely 
in the levelplot (look at the color range at the right side!).
I guess it might also happen in my case...

I've tested several cases and it looks like the length of the color-vector 
should be one less than the at vector (which would make sense).

Then, the rule might apply:

[ at[1],at[2] ] = color[1]
( at[2],at[3] ] = color[2]
...
( at[n-1],at[n] ] = color[n-1]


Please correct me if I'm wrong!!!

Antje




More information about the R-help mailing list