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

Roger Bivand Roger.bivand at nhh.no
Sat Dec 3 12:50:03 CET 2011


David Epstein <davideps <at> umich.edu> writes:

> 
> 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:
> 
....
> 
> I can display a single thematic map for a city using spplot as follows:
> 
> spplot(Minneapolis,"Thematic_Data_Column")
> 

The spplot function uses lattice graphics, so you may use the standard methods
for the "trellis" objects that it returns. If you did something like:

sp_out_Minneapolis <- spplot(Minneapolis, "your_var")
print(sp_out_Minneapolis, split=c(1, 1, 2, 1), more=TRUE)
sp_out_Cleveland <- spplot(Cleveland, "your_var")
print(sp_out_,Cleveland split=c(2, 1, 2, 1), more=FALSE)

you will get some of the way there. If in addition you would like only one
legend using the same breaks and colours, you'll need to use appropriate
arguments to spplot() in both calls to handle this.

It may be worth considering posting queries of this kind on R-sig-geo, as
response may be forthcoming more quickly there.

Hope this helps,

Roger

> 
> thank you,
> -david
> 
>



More information about the R-help mailing list