Description
Description of the desired feature
Implement inset
which " is used to carve out a sub-region of the current plot canvas and restrict further plotting to that section of the canvas".
At the moment, users have to manually position inset maps using xshift and yshift (which was aliased in #624). Still, the results can be impressive as in this example (from https://github.com/mrsiegfried/Venturelli2020-GRL):
There's a gallery example over at GMT at https://docs.generic-mapping-tools.org/6.1/gallery/ex44.html on inset
, and also a good GMT tutorial (in Chinese) at https://docs.gmt-china.org/latest/tutorial/inset/ we could translate over:
How should we implement this though? This is actually quite tricky since we need to have the inset map nested inside an existing figure. The user experience side of things also needs to be considered, and it's tricky balancing the two.
Option 1 would be to put it in a with
statement/context manager:
with pygmt.inset(...):
fig.basemap(...)
fig.colorbar(...)
Option 2 might be to declare the start and end inset explicitly (similar, but not exactly the same as the current subplot wrapper at #427). :
fig.begin_inset()
fig.basemap(...)
fig.colorbar(...)
fig.end_inset()
Thoughts? Any Option 3?
Are you willing to help implement and maintain this feature? Eventually, perhaps good to model the implementation after the subplot implementation at #427