[R-sig-Geo] create inset map
Edzer Pebesma
edzer.pebesma at uni-muenster.de
Sat Oct 15 17:36:59 CEST 2011
you might want to look at maptools::elide, to shift Sao to the Africa
map, and perhaps rbind() the two objects into a single object for spplot.
Alternative, pass Sao in sp.layout, but than you'd have to do the
colouring yourself, which might be fine if you need to do it just once.
On 10/15/2011 05:01 PM, dieter Vanderelst wrote:
> Hello List,
>
> I have a map of Africa I plot using spplot(). In addition, I have a
> second map of Sao Tome (a small island). I want to add this second map
> to the first as an inset because it would otherwise not be visible at
> the same scale of the continent.
>
> This is what I currently do: I save both maps to a variable and plot
> them using the print.trellis function (see
> http://stat.ethz.ch/R-manual/R-devel/library/lattice/html/print.trellis.html).
>
>
> This is the code:
> p1<-spplot(Africa,c('var1'))
> p2<-spplot(Sao,c('var1'))
> print(p1,position=c(0,0,1,1),more=T)
> print(p2,position=c(0,0,0.3,0.3),more=T)
>
> This results is a map of Africa with a second map of Sao in the left
> bottom corner.
>
> However, the location of the inset in the larger map is difficult to
> control using this code. Spplot enforces the aspect ratio of the maps to
> be respected. Of course, this is necessary for mapping. However, this
> seems to conflict with the position arguments in the print statements.
>
> Does anybody have some which allows controlling the location of an inset
> map in a larger map?
>
> Regards,
> Dieter
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
--
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763 http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics e.pebesma at wwu.de
More information about the R-sig-Geo
mailing list