Skip to content

Keep using a single dividers LineCollection instance in colorbar. #17834

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
Jul 5, 2020

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jul 4, 2020

... updating its data as needed, instead of repeatedly deleting it and
instantiating new ones.

Similar to #15981, just for another attribute.

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/next_api_changes/* if API changed in a backward-incompatible way

@anntzer anntzer added this to the v3.4.0 milestone Jul 4, 2020
dividers : `.LineCollection`
A LineCollection if *drawedges* is ``True``, otherwise ``None``.
A LineCollection (empty if *drawedges* is ``False``).
Copy link
Member

Choose a reason for hiding this comment

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

Should this get an API change note?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think this is an API break because previously the attribute could be LineCollection or None, and now it's always LineCollection, so we don't add more types to handle.

Copy link
Member

Choose a reason for hiding this comment

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

Technically, people could have checked cb.dividers is None, which now would have to be changed to not cb.dividers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, added changelog

@efiring
Copy link
Member

efiring commented Jul 4, 2020

This is a nice simplification.

I don't find any test or example usage of the "drawedges" kwarg in any .py file in our repo.

Searching for "drawedges" shows that it is also supported in axes_grid1/colorbar.py, which is deprecated as of 3.2.

self.dividers = None
self.dividers = collections.LineCollection(
[],
colors=[mpl.rcParams['axes.edgecolor']],
Copy link
Member

Choose a reason for hiding this comment

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

Doesn't this change the time of rcParams resolution from draw-time to init?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The same "change in resolution time" occurred in #15981, where it is arguably a bugfix.
But sure, added to the changelog.

... updating its data as needed, instead of repeatedly deleting it and
instantiating new ones.
@anntzer anntzer force-pushed the keepcbardividers branch from 100c161 to 28b69e6 Compare July 5, 2020 10:00
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.

4 participants