Skip to content

Programmatically generate signature of Figure.savefig. #24405

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Nov 9, 2022

Note that the previously documented "Call signature" did not mention "transparent".

Also adjust tools/boilerplate.py so that pyplot.savefig can also benefit from this change; this implies generalizing
axes_cmappable_method_template to support general postambles, also for Figure methods.

See the new signature of pyplot.savefig for the end result.


Edit: This currently fails test_agg.py::test_webp_alpha because facecolor=None is now explicitly passed to Figure.savefig, which prevents kwargs.setdefault("facecolor", "none") from taking effect, and facecolor=None is instead interpreted as "use the rcparam" :/ Probably easy to fix, but needs some thought about strict backcompat.

PR Summary

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • New plotting related features are documented with examples.

Release Notes

  • New features are marked with a .. versionadded:: directive in the docstring and documented in doc/users/next_whats_new/
  • API changes are marked with a .. versionchanged:: directive in the docstring and documented in doc/api/next_api_changes/
  • Release notes conform with instructions in next_whats_new/README.rst or next_api_changes/README.rst

Note that the previously documented "Call signature" did not mention
"transparent".

Also adjust tools/boilerplate.py so that pyplot.savefig can also benefit
from this change; this implies generalizing
axes_cmappable_method_template to support general postambles, also for
Figure methods.

See the new signature of pyplot.savefig for the end result.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant