(44) Map insets

In this example show how [inset] can be used to place map insets on top of your map. The map inset is usually intended for placing a smaller-scale version of the larger geographical context of your main plot, so that reader unfamiliar with the detailed map can see what region we are looking at. The inset module automatically determines the possible extent of the map hence we simply pass ? for the unknown map sizes.

using GMT
resetGMT() # hide

coast(region="110E/170E/44S/9S", proj=:merc, figsize=15, shore=:faint, borders=(type=2, pen=1),
      DCW=(country="AU", fill=:bisque), land=:brown, water=:azure1)
basemap!(inset=(inside=true, anchor=:TR, width=3.8, offset=(0.4, 0.25), save="xx000.dat"),
         box=(fill=:white, pen=1, clearance=0.1, shaded=true))
t = gmtread("xx000.dat").data   # x0 y0 w h

coast!(region=:global360, proj=(name=:ortho, center=(120,-30), parallel=t[3]),
       land=:brown, area=5000, frame=(grid=:auto,), shore=:faint, DCW=(country="AU", fill=:bisque),
       xshift=t[1], yshift=t[2]);

# Determine size of insert map of Europe
tt = mapproject(region=(-15,35,30,48), proj=:merc, figsize=5, map_size=true); # w h
mapW = tt.data[1];   mapH = tt.data[2]
coast!(region=(-10,5,35,44), proj=:merc, figsize=15, frame=(axes=:WSne, annot=:auto, ticks=:auto),
       DCW=(country="ES", fill=:bisque), land=:brown, shore=:faint, borders=(type=1,pen=1),
       water=:azure1, res=:full, xshift=-t[1], yshift=11.5-t[2], par=(:FORMAT_GEO_MAP, :dddF))
basemap!(inset=(inside=true, anchor=:TR, size=(mapW, mapH), offset=(0.4, 0.25), save="xx000.dat"),
         box=(fill=:white, pen=1, clearance=0.1, shaded=true))
t = gmtread("xx000.dat").data   # x0 y0 w h
coast!(region=(-15,35,30,48), proj=:merc, figsize=t[3], land=:brown, frame=:bare,
       DCW=(country="ES", fill=:bisque), par=(:MAP_FRAME_TYPE, :plain),
       xshift=t[1], yshift=t[2], show=true)
rm("xx000.dat")
MethodError: no method matching inset_nested(::Bool, ::Int64; offset::Tuple{Float64, Float64}, save::String, anchor::Symbol, width::Float64)

Closest candidates are:
  inset_nested(::String, ::Any; kwargs...)
   @ GMT C:\Users\j\.julia\dev\GMT\src\gmtbegin.jl:142
  inset_nested(::Function, ::Any; kwargs...)
   @ GMT C:\Users\j\.julia\dev\GMT\src\gmtbegin.jl:189
  inset_nested(::GDtype, ::Any; kwargs...)
   @ GMT C:\Users\j\.julia\dev\GMT\src\gmtbegin.jl:171
  ...


Stacktrace:
 [1] inset_nested(nt::@NamedTuple{inside::Bool, anchor::Symbol, width::Float64, offset::Tuple{Float64, Float64}, save::String}, n::Int64)
   @ GMT C:\Users\j\.julia\dev\GMT\src\gmtbegin.jl:136
 [2] add_opt_module(d::Dict{Symbol, Any})
   @ GMT C:\Users\j\.julia\dev\GMT\src\finish_PS_nested.jl:65
 [3] finish_PS_nested(d::Dict{Symbol, Any}, cmd::Vector{String})
   @ GMT C:\Users\j\.julia\dev\GMT\src\finish_PS_nested.jl:7
 [4] helper_basemap(O::Bool, K::Bool, d::Dict{Symbol, Any})
   @ GMT C:\Users\j\.julia\dev\GMT\src\psbasemap.jl:67
 [5] #helper_basemap#919
   @ C:\Users\j\.julia\dev\GMT\src\psbasemap.jl:49 [inlined]
 [6] helper_basemap
   @ C:\Users\j\.julia\dev\GMT\src\psbasemap.jl:47 [inlined]
 [7] #basemap!#918
   @ C:\Users\j\.julia\dev\GMT\src\psbasemap.jl:46 [inlined]
 [8] top-level scope
   @ In[2]:6