[R] side-by-side map with different geographies using spplot

David Epstein davideps at umich.edu
Sat Dec 3 03:39:47 CET 2011


Hello,

I want to create side-by-side maps of similar attribute data in two 
different cities using a single legend.

To simply display side-by-side census block group boundary 
(non-thematic) maps for Minneapolis & Cleveland I do the following:

library(rgdal)
library(sp)
Minneapolis=readOGR("../Minneapolis/Census/2010/Census_BlockGroup_GEO/","tl_2010_27053_bg10")
Cleveland=readOGR("../Cleveland/Census/2010/Census_BlockGroup_GEO/","tl_2010_39035_bg10")
par(mfrow=c(1,2))
plot(Minneapolis)
plot(Cleveland)

I can display a single thematic map for a city using spplot as follows:

spplot(Minneapolis,"Thematic_Data_Column")

But, calling the function again for Cleveland just overwrites the 
window. I am unsure how to use spplot's layout tools with two different 
geographies. Most examples use a single geography and multiple attribute 
columns. Alternatively, is there a way to use "par" together with spplot 
to allow for multiple spplot calls?

thank you,
-david



More information about the R-help mailing list