Fix colorbar aspect when colorbar created, not its axes...#22100
Closed
jklymak wants to merge 4 commits intomatplotlib:mainfrom
Closed
Fix colorbar aspect when colorbar created, not its axes...#22100jklymak wants to merge 4 commits intomatplotlib:mainfrom
jklymak wants to merge 4 commits intomatplotlib:mainfrom
Conversation
Member
Author
|
This logic also fails, because we modify the box_aspect as part of the algorithm to shrink the axes for extend triangles. So if we redraw, we keep making the colorbar aspect smaller and smaller! |
Member
Author
|
I think the proper solution here is that colorbar needs to know its aspect ratio, and that the user cannot control the underlying axes aspect ratio directly. I think that can mostly work now, but we would need to grow a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary
Closes #22087 (?)
Creating a colorbar axes and then subsequently setting its aspect ratio after creation, but before creating the colorbar, failed after #20501. That is because the new colorbar logic consults
cax._colorbar_infofor the aspect ratio of the colorbar, and we were setting that when the colorbar axes was created. Here we change the logic so the aspect ratio is not set until the colorbar is put into the axes.#22087 is still broken in that users used to be able to set the aspect ratio via
cax.set_aspect, whereas now we are usingcax.set_box_aspect. That could maybe be fixed.We probably should also allow a way for colorbars to reset their aspect ratio (#20588).
PR Checklist
Tests and Styling
pytestpasses).flake8-docstringsand runflake8 --docstring-convention=all).Documentation
doc/users/next_whats_new/(follow instructions in README.rst there).doc/api/next_api_changes/(follow instructions in README.rst there).