[R] "Continuously colored" colorkey
Jan Marius Hofert
m_hofert at web.de
Sat Mar 4 17:24:00 CET 2006
Hi,
I use the levelplot function of the lattice library with the option
col.regions=gray(200:400/400) in order to get a "color-grid" of 201
different gray colors (actually if you look at the vector, some
consecutive colors are the same). In order to make the colors in the
colorkey as "smooth/continuous" as possible I use the maximal number
which is possible for the "cuts"-options, i.e. I use cuts=200 (the
standard for col.regions is 100 colors between green and red, so the
maximal number for cuts is 99. A higher number for "cuts" starts the
colors from the beginning again...).
Now with these settings (or even with a much smaller number for
"cuts"), I always obtain _some_ small stripes between the colors of
the colorkey (not between _every_ color change, just between _some_).
Of course these stripes have a different color, otherwise I would not
see them. This looks pretty bad (especially if an almost white stripe
lies between 2 dark colors). Is there a way to fix that?
I just would like the colorkey to be as "continuously colored" as
possible, so one should not think that the color "jumps" somewhere...
I use code like the following to obtain the plots:
trellis.device(postscript,color=F,horizontal=F,onefile=F,file="...")
levelplot(z~x*y,col.regions=gray(200:400/400),cuts=200,colorkey=list
(tick.number=6))
dev.off() #close trellis device
Thanks in advance
marius
More information about the R-help
mailing list