Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrapper for inset #663

Closed
weiji14 opened this issue Oct 22, 2020 · 1 comment · Fixed by #788
Closed

Wrapper for inset #663

weiji14 opened this issue Oct 22, 2020 · 1 comment · Fixed by #788
Labels
feature request New feature wanted help wanted Helping hands are appreciated
Milestone

Comments

@weiji14
Copy link
Member

weiji14 commented Oct 22, 2020

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):

Cool example of manually positioning map insets over Antarctica

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:

GMT inset example

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

@weiji14 weiji14 added help wanted Helping hands are appreciated feature request New feature wanted labels Oct 22, 2020
@weiji14 weiji14 added this to the 0.3.0 milestone Oct 22, 2020
@seisman
Copy link
Member

seisman commented Oct 22, 2020

Still, the results can be impressive as in this example (from https://github.com/mrsiegfried/Venturelli2020-GRL):

It's a really beautiful and impressive figure! 🤩

@willschlitzer willschlitzer mentioned this issue Jan 3, 2021
5 tasks
@willschlitzer willschlitzer linked a pull request Jan 22, 2021 that will close this issue
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature wanted help wanted Helping hands are appreciated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants