Skip to content
Prev 4746 / 29559 Next

fixed colors in maps (Katona Lajos)

Dear all,

I've uploaded a new sp version to /incoming on CRAN (0.9-29) where 
spplot should deal better with factors as dependent variables. As 
levelplot does not really have this functionality, it involved a bit of 
work on the spplot side.

Now, spplot checks that all factors in layers (panels) have the same 
levels; I cannot see use of paneled plots for factors having different 
levels; this means that the example Jon Loehrke gave, to which I reacted 
with a note that the resulting plot was wrong on

https://stat.ethz.ch/pipermail/r-sig-geo/2008-December/004729.html

now breaks with an error condition. Please convince me if you think this 
is bad design.

Also, when plotting factors, the length of the col.regions color ramp 
now needs to equal the number of factor levels. An exception is when 
plotting points; in this case a single color is also accepted (because 
you may want to use point symbols to distinguish classes). The default 
color setting for factors is still that for continuous variables (the 
cm.colors() default of lattice); I'm quite unhappy about this but am 
also reluctant to make sp dependent on RColorBrewer.

Please test & comment; happy new year!
--
Edzer
Katona Lajos wrote:
meuse$color_codes=as.numeric(meuse$ffreq)+as.numeric(meuse$soil)+as.numeric(meuse$lime)
first 3
between 6 and