How to create a map inside a map in R -


i'm trying create figure large map of section of australian coast, smaller map inset showing whole of continent in top right corner. problem when run code inset, appears in right place, first map disappears.

here reproducible example:

install.packages("maps") install.packages("mapdata") library(maps) library(mapdata) # create main map map("world2hires",     ylim=c(-17,-11),xlim=c(121, 126),     fill=true, col="grey") maps::map.scale( 124.6,-16.65, ratio=false, relwidth=0.15) box() # create inset par(fig = c(.60, 1, .60, 1), mar=c(0,0,0,0)) map("world2hires",     ylim=c(-40,-0),xlim=c(110, 155),     fill=true, col="grey") box() 

these maps want produce in single image; smaller in top right corner of larger: main map top right inset

edit:

following thread linked thelatemail, tried using new=true , add=true follows:

 # create main map map("world2hires",     ylim=c(-17,-11),xlim=c(121, 126),     fill=true, col="grey") maps::map.scale( 124.6,-16.65, ratio=false, relwidth=0.15) box() # create inset par(fig = c(.60, 1, .60, 1), mar=c(0,0,0,0), new=true) map("world2hires",     ylim=c(-40,-0),xlim=c(110, 155),     fill=true, col="grey", add=true) box() 

however, result bit strange: enter image description here

not sure what's going on. need play margins inset in right spot, fine, don't know why it's not using map coordinates inset.

any insight appreciated! thanks.


Comments

Popular posts from this blog

How to connect android app to App engine -

gcc - MinGW's ld cannot perform PE operations on non PE output file -

php - display validation error message next to the textbox in codeigniter -