Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Give _DummyAxis instances a __name__ #17625

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 3 commits into from
Jun 15, 2020

Conversation

efiring
Copy link
Member

@efiring efiring commented Jun 13, 2020

PR Summary

ScalarFormatter.format_data_short uses self.axis.__name__ to determine whether it is working with an x-axis, a y-axis, or something else, presumably a _DummyAxis instance. This was failing in the z-cursor formatting of image-like plots for a the colorbar use case with boundaries specified. This could be solved either by checking first for the presence of the __name__ attribute or by giving _DummyAxis instances a name. I chose the latter approach.

Closes #17624

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

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

"both" might be the best option here to avoid playing whack-a-mole.

@efiring
Copy link
Member Author

efiring commented Jun 14, 2020

OK, I've added the "both" strategy. I was vacillating originally as to whether to do that. It probably makes sense; users might have their own dummy axis classes.

@tacaswell tacaswell added this to the v3.3.0 milestone Jun 15, 2020
@QuLogic QuLogic merged commit c8e7865 into matplotlib:master Jun 15, 2020
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.

_DummyAxis needs a __name__ attribute for ScalarFormatter
4 participants