Skip to content

Putting Multiple spplots in the same page

2 messages · Barry Rowlingson, Samuel Turgeon

#
On Tue, Jul 17, 2012 at 5:19 PM, Roosbeh Nowrouzian
<roosbeh.nowrouzian at gmail.com> wrote:
Either ditch spplot and realise that for single maps all that
spplot(foo,"bar") is doing is essentially plot(foo,col=f(foo$bar)).
Just write a function f to map values to colours in a palette and do
that, with par(mfrow=c(2,2)). Also, spplots default palette is awful
for points - you'll get white points on a white background, so don't
use that.

If you dont want to customise your maps with base graphics you need to
dive into grid graphics, get the gridExtra package and then:

 > require(gridExtra)
 > grid.arrange(spplot(meuse,"zinc"),spplot(meuse,"cadmium"),spplot(meuse,"lead"),spplot(meuse,"copper"),ncol=2)

Its a whole new world. Anyway, you'll probably want to do this with
ggplot2 next...

Barry