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

Skip to content

FIX: Handle inverted colorbar axes with extensions #22635

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
Mar 14, 2022

Conversation

greglucas
Copy link
Contributor

PR Summary

This fixes the colorbar extensions to use the proper color when the long axis is inverted. One of the issues is that the extensions are created immediately upon colorbar creation, but not updated with new draws. This adds a callback listener on xlim/ylim changes for the colorbar axes to redraw the extensions, so it is a bit unfortunate in that sense, but not too bad.

Closes #22052

PR Checklist

Tests and Styling

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (install flake8-docstrings and run flake8 --docstring-convention=all).

Documentation

  • [N/A] New features are documented, with examples if plot related.
  • [N/A] New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • [N/A] API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).
  • [N/A] Documentation is sphinx and numpydoc compliant (the docs should build without error).

@tacaswell tacaswell added this to the v3.5.2 milestone Mar 10, 2022
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 looks great. I guess a callback is the correct solution here. I get a little concerned when there are a lot of callbacks, but I can't think of a better way to do this.

This fixes the colorbar extensions to use the proper color when the
long axis is inverted.
@oscargus oscargus merged commit 32fff69 into matplotlib:main Mar 14, 2022
@lumberbot-app
Copy link

lumberbot-app bot commented Mar 14, 2022

Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

  1. Checkout backport branch and update it.
git checkout v3.5.x
git pull
  1. Cherry pick the first parent branch of the this PR on top of the older branch:
git cherry-pick -m1 32fff69df48a2cec138018ce23c474bf32c4337a
  1. You will likely have some merge/cherry-pick conflict here, fix them and commit:
git commit -am 'Backport PR #22635: FIX: Handle inverted colorbar axes with extensions'
  1. Push to a named branch:
git push YOURFORK v3.5.x:auto-backport-of-pr-22635-on-v3.5.x
  1. Create a PR against branch v3.5.x, I would have named this PR:

"Backport PR #22635 on branch v3.5.x (FIX: Handle inverted colorbar axes with extensions)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the Still Needs Manual Backport label once the PR gets merged.

If these instructions are inaccurate, feel free to suggest an improvement.

@greglucas greglucas deleted the cbar-inverted branch March 14, 2022 14:13
greglucas pushed a commit to greglucas/matplotlib that referenced this pull request Mar 14, 2022
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.

[Bug]: invert_yaxis function cannot invert the "over value" in colorbar axes
5 participants