Skip to content

Colorbar cleanup. #15982

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
Jan 11, 2020
Merged

Colorbar cleanup. #15982

merged 1 commit into from
Jan 11, 2020

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Dec 19, 2019

Deprecate on_mappable_changed in favor of update_normal (they're the
same now (except for a logging call) now that colorbars just use the
norm of the mappable).

Deprecate update_bruteforce in favor of update_normal -- it's not used
anywhere except in axes_grid, but that's just because whoever introduced
update_normal forgot to update axes_grid at the same time.

axes_grid.colorbar is already deprecated but until its complete removal,
we need to backport update_normal to it...

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

@@ -715,6 +715,33 @@ def add_lines(self, CS):
#tlinewidths = [col.get_linewidth()[0] for lw in CS.collections]
ColorbarBase.add_lines(self, CS.levels, tcolors, tlinewidths)

def update_normal(self, mappable):
"""
Copy link
Member

Choose a reason for hiding this comment

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

I guess this needs some sort of test while we are here....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Given that axes_grid1.colorbar is already deprecated, I would rather not bother...

Copy link
Member

Choose a reason for hiding this comment

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

Oh I didn't catch that.

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Agree, these methods confused me when I first dug into the code, so any simplification is good. It looks like they were largely just there for axes_grid

@timhoffm timhoffm added this to the v3.3.0 milestone Jan 10, 2020
@timhoffm
Copy link
Member

May self-merge after CI resolving the conflict.

Deprecate on_mappable_changed in favor of update_normal (they're the
same now (except for a logging call) now that colorbars just use the
norm of the mappable).

Deprecate update_bruteforce in favor of update_normal -- it's not used
anywhere except in axes_grid, but that's just because whoever introduced
update_normal forgot to update axes_grid at the same time.

axes_grid.colorbar is already deprecated but until its complete removal,
we need to backport update_normal to it...
@anntzer
Copy link
Contributor Author

anntzer commented Jan 11, 2020

self-merge per above.

@anntzer anntzer merged commit 7c04486 into matplotlib:master Jan 11, 2020
@anntzer anntzer deleted the colorbar branch January 11, 2020 12:27
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.

3 participants