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

Handling plotting functions that have an inquire (I) only mode #896

Open
weiji14 opened this issue Feb 15, 2021 · 3 comments
Open

Handling plotting functions that have an inquire (I) only mode #896

weiji14 opened this issue Feb 15, 2021 · 3 comments
Labels
question Further information is requested

Comments

@weiji14
Copy link
Member

weiji14 commented Feb 15, 2021

Description of the issue

There are a few GMT modules that have a mode for extracting data (statistics or otherwise) via the inquire (I) flag in addition to plotting:

How do we want to handle these cases? It seems weird to use fig.histogram(..., inquire=...) if no figure/plot is actually returned. One suggestion made at #794 (review) was:

Ideally, what we might have to do is make two user-facing rose functions:

1. A plotting-only `fig.rose`

2. A non-plotting `pygmt.rose` which will solely use the inquire (I) flag.

Both of these could share a core def _rose() function and live within pygmt/src/rose.py. This is just an idea though, and probably quite hard to implement in one Pull Request. For now, we could implement just the plotting side (1) and raise a NotImplementedError for inquire (I), and perhaps wrap pygmt.rose (2) in a future PR? Or maybe there's a smarter alternative way.

Open to suggestions on how we want the API for this look like.

Are you willing to help implement and maintain this feature? Discuss first

@weiji14 weiji14 added the question Further information is requested label Feb 15, 2021
@michaelgrund
Copy link
Member

How do we want to handle these cases? It seems weird to use fig.histogram(..., inquire=...) if no figure/plot is actually returned.

I totally agree that it feels quite strange if no plotting object is returned when applying these modules.

One suggestion made at #794 (review) was:

Ideally, what we might have to do is make two user-facing rose functions:

1. A plotting-only `fig.rose`

2. A non-plotting `pygmt.rose` which will solely use the inquire (I) flag.

Both of these could share a core def _rose() function and live within pygmt/src/rose.py. This is just an idea though, and probably quite hard to implement in one Pull Request. For now, we could implement just the plotting side (1) and raise a NotImplementedError for inquire (I), and perhaps wrap pygmt.rose (2) in a future PR? Or maybe there's a smarter alternative way.

Sounds like a good compromise, however, does it make sense for all modules that have the -I flag or only for a few of them?

@weiji14
Copy link
Member Author

weiji14 commented Feb 28, 2021

Sounds like a good compromise, however, does it make sense for all modules that have the -I flag or only for a few of them?

As far as I can tell, it's only 3 modules (rose, solar and histogram) where this applies. For other modules, the -I flag means something else (e.g. spacing) and not 'inquire'.

@seisman
Copy link
Member

seisman commented Sep 3, 2021

Please note that there are more plotting modules that can "dump" something to a file without plotting anything:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants