Here is an example using the subplot function.

library(TeachingDemos)
map("state", region= "ohio", xlim=c(-85, -80), ylim=c(38, 42))
tmp <- subplot(map("state",add=TRUE), 'bottomright', type='fig',
size=c(0.2,0.2), inset=0.1)
op <- par(fig=tmp$fig)
map("state", region="ohio", fill=T, add=T)
par(op)

With maps trying to redo the graphics parameters you need to play
around with the settings a little.  subplot works better with
type='fig' with maps.


On Mon, Jun 9, 2014 at 12:31 AM, Jeff Newmiller
<jdnew...@dcn.davis.ca.us> wrote:
> Please don't post HTML email.. we don't necessarily see what you see when you 
> do that. Read the Posting Guide for more list etiquette.
>
> Have you played with the "usr" coordinates? Have you read the help for the 
> par function?
> The par(usr=...) call is telling base graphics what the x and y coordinates 
> of the corners of the graphics window should be. If you subtract the same 
> number from x1 and x2 you will shift the inset to the right because the 
> coordinates of the left edge of the window will be further to the left of the 
> map and the right edge of the window will be closer to the map on the right.
>
> ---------------------------------------------------------------------------
> Jeff Newmiller                        The     .....       .....  Go Live...
> DCN:<jdnew...@dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
>                                       Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
> /Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
> ---------------------------------------------------------------------------
> Sent from my phone. Please excuse my brevity.
>
> On June 8, 2014 9:29:02 PM MDT, Carly Muletz <craemul...@gmail.com> wrote:
>>This is in reference to the post here by Ray Brownrigg:
>>http://r.789695.n4.nabble.com/inset-one-map-on-top-of-another-map-td3848752.html
>>
>>using this code with the maps package:
>>
>>map("state", region= "ohio", xlim=c(-85, -80), ylim=c(38, 42))
>>par(usr=c(-216, -66, 24, 144))   # you should be able to 'automate'
>>this
>>calculation
>>map("state", add=T)
>>map("state", region="ohio", fill=T, add=T)
>>
>>*MY issue*: I can't figure out how to determine which values to specify
>>for
>>par(usr=c(______))
>>
>>I can get the values of the plot area using
>>
>>par("usr")
>>
>>But I don't know how to resize the second map or move it to another
>>location. When I adjust the values specified it just seems to stretch
>>the second map out.
>>
>>Here is a basic idea of what I am trying to do
>>
>>library(maps)
>>map('state', xlim = c(-86.5,-74), ylim= c(32,41.25), col = "white",
>>fill =
>>T)
>>
>>par(usr=c(-216, -66, 24, 144))
>>par(xpd=T)
>>
>>map("state",  xlim = c(-105,-70), ylim= c(25,48), add = T)
>>
>>---but I would like the US map to be larger and moved to the right
>>
>>Thanks!
>>
>>Carly
>>
>>       [[alternative HTML version deleted]]
>>
>>______________________________________________
>>R-help@r-project.org mailing list
>>https://stat.ethz.ch/mailman/listinfo/r-help
>>PLEASE do read the posting guide
>>http://www.R-project.org/posting-guide.html
>>and provide commented, minimal, self-contained, reproducible code.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to