[R] map with inset

David Winsemius dwinsemius at comcast.net
Wed Oct 16 18:39:38 CEST 2013


On Oct 16, 2013, at 3:47 AM, markw wrote:

> Hi, 
> 
> I am trying to put an inset of North America onto a finer-scale map and
> cannot seem to get the two maps on the same plot.
> 
> the main map is:
> map("worldHires", c("Canada", "USA"), xlim=c(-75, -52), ylim=c(40, 55),
> col="gray90", fill=TRUE)
> map.axes()
> map('rivers', add=TRUE)
> map.scale(-73, 54, relwidth=0.2, ratio=FALSE)
> rect(-59.5, 46.5, -52,52)
> text(-53,51.5,"A")
> rect(-69, 43, -59.5,49.5)
> text(-60, 49, "B") 
> 
> and in the bottom right corner I want the following map scaled so it doesn't
> overlap with my main map:
> map("worldHires", c("Canada", "USA"), xlim=c(-170, -50), ylim=c(24, 90),
> proj="gilbert")
> 
> Any suggestions?

Take a look at eitehr of TeachingDemos or Hmisc packages. I think they both have a `subplot` function (although the functions are not the same.)

-- 

David Winsemius
Alameda, CA, USA



More information about the R-help mailing list