Hi all,
I assumed that region and projection only need to be set once within a Figure.inset() with block, but when working off the inset rectangle gallery example my student found that the output of the plot call shifts based on the region set in the coast call, unless projection and region are also set in the plot. I have copied a minimal example below. Is this to be expected? I am not sure if this is an oddity about hierarchical levels similar to the subplot question.
Thanks!
Example with correct rectangular box in inset region
import pygmt
region=[-91.25,-91,-0.95,-0.7]
inset_region = [-92,-89.5,-1.75,1]
inset_projection = "M3.5c"
data = pygmt.datasets.load_earth_relief(region=region, resolution='03s')
fig = pygmt.Figure()
pygmt.makecpt(cmap="batlow", series=[0, 1135])
fig.grdimage(
grid=data,
region=region,
shading=True,
cmap=True,
frame=True,
projection="M10c"
)
with fig.inset(position="jBL+w3.5c+o0.2c", box="+pblack"):
fig.coast(
region=inset_region,
shorelines="thin",
projection=inset_projection,
land="lightyellow",
water="lightblue",
frame="a"
)
rectangle = [[region[0], region[2], region[1], region[3]]]
fig.plot(data=rectangle, style="r+s", projection=inset_projection, region=inset_region, pen="1p,blue")
fig.show()
Example with rectangular box offset in inset
import pygmt
region=[-91.25,-91,-0.95,-0.7]
inset_region = [-92,-89.5,-1.75,1]
inset_projection = "M3.5c"
data = pygmt.datasets.load_earth_relief(region=region, resolution='03s')
fig = pygmt.Figure()
pygmt.makecpt(cmap="batlow", series=[0, 1135])
fig.grdimage(
grid=data,
region=region,
shading=True,
cmap=True,
frame=True,
projection="M10c"
)
with fig.inset(position="jBL+w3.5c+o0.2c", box="+pblack"):
fig.coast(
region=inset_region,
shorelines="thin",
projection=inset_projection,
land="lightyellow",
water="lightblue",
frame="a"
)
rectangle = [[region[0], region[2], region[1], region[3]]]
fig.plot(data=rectangle, style="r+s", pen="1p,blue")
fig.show()

