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

Skip to content

Set colorbar label only in set_label. #17806

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 1, 2020

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Jun 30, 2020

... instead of doing so also in _config_axis.

_config_axis is also called when e.g. the norm is changed, but we don't
want to reset the label in that case.

Note that the previous self._labelkw was only usable for one colorbar
orientation anyways (because the choice of _pos_kw depends on the
orientation) so everything was already tied to a single orientation.

Closes #17804.

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

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.

This seems right to me. Curious why set_label was ever called before on config_axis....

@jklymak
Copy link
Member

jklymak commented Jun 30, 2020

I guess it could get a test with the functionality in #17804?

@anntzer
Copy link
Contributor Author

anntzer commented Jun 30, 2020

You (or whoever cares enough) get to push one ;)

@@ -548,7 +548,6 @@ def _config_axis(self):
ticks_position=self.ticklocation)
short_axis.set_ticks([])
short_axis.set_ticks([], minor=True)
self._set_label()
Copy link
Member

Choose a reason for hiding this comment

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

Does it still make sense to set self.stale = True here though?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

indeed.

... instead of doing so also in _config_axis.

_config_axis is also called when e.g. the norm is changed, but we don't
want to reset the label in that case.

Note that the previous `self._labelkw` was only usable for one colorbar
orientation anyways (because the choice of `_pos_kw` depends on the
orientation) so everything was already tied to a single orientation.
@tacaswell tacaswell added this to the v3.4.0 milestone Jul 1, 2020
@tacaswell tacaswell merged commit c2e09e8 into matplotlib:master Jul 1, 2020
@anntzer anntzer deleted the eagercbarlabel branch July 1, 2020 21:47
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.

Setting the norm on imshow object removes colorbar ylabel
4 participants