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

Patrick Brown patrick.brown at utoronto.ca
Fri Feb 26 15:27:32 CET 2016

```Hi.

1- `insetMap` returns a matrix of x and y coordinates, you needn't
plot all of them.

```
nica <- getData("GADM", country="NIC", level=0)
nicabg <- openmap(nica, path="landscape")
map.new(nicabg,1,mar=c(2, 2, 2, 0) + 0.1)
plot(nicabg,axes=TRUE)
loc <- insetMap(nica,pos=c(-89.9,8.5), width=0.3, col=NA, lty=0,pch=".")
points(loc[1,1], loc[1,2], pch=3)
```

2- `dev.size()` gives you the size of the plotting window.  the best
way to control the plot size is to save it to a file.

```
png("myfile.png", height=400, width=300)
plot(nicabg)
dev.off()
```

p

On Fri, Feb 26, 2016 at 5:02 AM, Agustin Lobo <alobolistas at gmail.com> wrote:
> Much better now!
>
> nica <- getData("GADM", country="NIC", level=0)
> nicabg <- openmap(nica, path="landscape")
> map.new(nicabg,1,mar=c(2, 2, 2, 0) + 0.1)
> plot(nicabg,axes=TRUE)
> loc <- insetMap(nica,pos=c(-89.9,8.5), width=0.3, col=NA, lty=0,pch=".")
> points(loc)
>
> Just 2 questions:
> 1. In the example you provide, the resulting mark is too thick. I've
> made a thinner version with pch=".", but
> it would nice having the option of just drawing the central point and
> not the window.
> 2. Is there a way to calculate the size of the plotting window so that
> there is no wasted white space
> between the map and the axes? I can do this by hand, but then cannot
> read the size.
>
> Thanks
>
> On Thu, Feb 25, 2016 at 6:46 PM, Patrick Brown
> <patrick.brown at utoronto.ca> wrote:
>> Hello all, my first post here!
>>
>>
>> mapmisc (1.4.8 from r-forge) now allows
>>
>>
>> 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)
>> loc = insetMap(nica,pos=c(-85,12), width=0.3, col=NA, lty=0)
>> points(loc)
>>
>> p
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

```