[R-sig-Geo] adding a background shape to ssplot

Edzer Pebesma edzer.pebesma at uni-muenster.de
Fri Dec 26 12:20:44 CET 2008


Jon Loehrke wrote:
> Greetings and Happy Holidays!
>
>
>   
...
> #However I can seem to pass the polygon colors argument through spplot
> spplot(nc1, c("f","g"), col.regions=brewer.pal(10, "Set3"),  
> scales=list(draw = TRUE),
> 	panel=function(...) {
> 		panel.mapper()
> 		sp.polygons(nc1)
> 		}
> 	)	
>
>   
A better panel function would be this:

spplot(nc1, c("f","g"), # col.regions=brewer.pal(10, "Set3"),
scales=list(draw = TRUE),
	panel=function(...) {
		panel.mapper()
		panel.polygonsplot(...)
		}
	)	


see

getMethod("spplot", "SpatialPolygonsDataFrame")

to find out how the appropriate spplot method does it.

I am worried, however, about the absence of the last 5 colors and factor
levels f-j.
--
Edzer




More information about the R-sig-Geo mailing list