-
Notifications
You must be signed in to change notification settings - Fork 224
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
Figure.show: Allow keyword arguments passed to Figure.psconvert #2078
Conversation
pygmt/figure.py
Outdated
**kwargs : dict | ||
Additional keyword arguments passed to | ||
:meth:`pygmt.Figure.psconvert`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure if we should use kwargs
or **kwargs
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look at some projects and there seems to be a mix 😅. Let's go with **kwargs
following https://docs.xarray.dev/en/v2022.06.0/generated/xarray.open_dataset.html, unless anyone else has a good reason on why not.
pygmt/figure.py
Outdated
dpi : int | ||
Set raster resolution in dpi. Default is 720 for PDF, 300 for | ||
others. | ||
**kwargs : dict | ||
Additional keyword arguments passed to | ||
:meth:`pygmt.Figure.psconvert`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find it a bit confusing that dpi
(an option in psconvert
) was previously an extra option or kwarg, but now there's both dpi
and **kwargs
in the Figure.savefig(...)
method shown in the documentation:
.
Not sure what's the best solution here. Removing the dpi
parameter documentation doesn't seem ideal, nor does including all of psconvert
's parameters in savefig
. Would it make sense then to put the dpi
documentation under **kwargs
? Or is there a cleaner solution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. Actually some of psconvert
's parameters (e.g., prefix
, fmt
) can NOT be used in Figure.show
or Figure.savefig
.
Perhaps we should say:
**kwargs: dict
Additional keyword arguments passed to `pygmt.Figure.pscovert`.
Valid parameters are `gs_path`, `gs_option`, `resize`, `bb_style`, and `verbose`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Also need to do a similar thing for the fig.show docstring.
Description of proposed changes
Add
**kwargs
toFigure.show
so that it can pass any keyword arguments toFigure.psconvert
.Figure.savefig()
already have**kwargs
.Fixes #2038
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version