8000 Simplify SubplotParams.update(). by anntzer · Pull Request #15200 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Simplify SubplotParams.update(). #15200

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

Merged
merged 1 commit into from
Oct 1, 2019
Merged

Conversation

anntzer
Copy link
Contributor
@anntzer anntzer commented Sep 6, 2019

by moving initialization, well, to __init__.

Also improve the class docstring.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell added this to the v3.3.0 milestone Sep 6, 2019
by moving initialization, well, to `__init__`.

Also improve the class docstring.
@ImportanceOfBeingErnest
Copy link
Member

There was an attempt to make subplots_adjust more user friendly in #11086, based on issue #11059.

@anntzer
Copy link
Contributor Author
anntzer commented Sep 8, 2019

I wrote this as a consequence of reviewing #11086, indeed. This PR doesn't change any of the current behavior, though.

val = rcParams[key]

setattr(self, s, val)
if left is not None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why don't you just move the assignment above the check so the check doesn't have to be so complicated? You will error out anyway is the check says to

Copy link
Contributor Author

Choose a reason for hiding this com 8000 ment

The reason will be displayed to describe this comment to others. Learn more.

Because the subplotparams instance would have been modified at that point, and would be left in an inconsistent state (e.g. if someone catches the exception -- they'll still be left with an unusable subplotparams).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... but they passed in unusable subplotparams. Are you saying they should have the defaults even if they passed in incorrect ones?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, if someone passes unusable subplotparams we should immediately error out without modifying the subplotparams instance, so it'll stay in a usable state.

@jklymak jklymak merged commit e3e864c into matplotlib:master Oct 1, 2019
@anntzer anntzer deleted the subplotpars branch October 1, 2019 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0