[R-sig-Geo] Problems with mapmisc::insetMap()

John Baumgartner johnbaums at gmail.com
Thu Feb 25 00:36:53 CET 2016


On Thu, Feb 25, 2016 at 4:26 AM, Agustin Lobo <alobolistas at gmail.com> wrote:
>
> Hi!
>
> When I make an insetMap for an small country, I get a very
> uggly "X" marking its position:
>
> require(rgdal)
> require(raster)
> require(mapmisc)
> nica <- getData("GADM", country="NIC", level=0)
> nicabg <- openmap(nica, path="landscape")
> map.new(nicabg, 0.7,mar=c(2, 2, 2, 0) + 0.1)
> plot(nicabg,axes=TRUE)
> plot(nica,add=TRUE)
> insetMap(nica,"bottomleft", width=0.3)
>
> is there a way to set another symbol or at least making it smaller?

Not quite what you asked for, but you could try TeachingDemos::subplots,
which you might find to be a little more flexible.

E.g.

library(TeachingDemos)
library(rgdal)

download.file(file.path('http://www.naturalearthdata.com/http/',
                        'www.naturalearthdata.com/download/110m/physical',
                        'ne_110m_land.zip'), f <- tempfile())
unzip(f, exdir=tempdir())
world <- readOGR(tempdir(), 'ne_110m_land')

plot(nica, col='gray90', border='black', axes=TRUE, xlim=c(-88, -81.5))
subplot({
  plot(world, col=1, xlim=c(-120, 30), ylim=c(-30, 40))
  box()
  points(coordinates(nica), pch=20, cex=2, col='red')
}, 'bottomright', inset=c(0.01, 0.01), size=c(1, 1))

>
> Also, despite the help page says that
> "Additional arguments passed to legend" are accepted, I do not find
> any to actually work.
> For example, cannot set the exact values of x,y for positioning the
> inset map. And cannot use locate() to put it wherever I want to.

The "additional arguments" are for scaleBar, which is also documented
at ?insetMap.
Note that there is no ellipsis (...) arg for insetMap.

>
> Thanks
>
> Agus
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



More information about the R-sig-Geo mailing list