| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
Could easily be back ported if not a bother. |
Sorry, something went wrong.
|
Should a non-visible axes take part in the layout? If the answer to that is yes, this is a good fix; but one might also consider that a non-visible axes may just be treated as "not there", or maybe as the most tiny box possible at the center of its original position? Forget the above. Yes, this is the correct fix. If you want to not have the axes take part in the layout you should use .remove() instead. |
Sorry, something went wrong.
|
An empty gridspec box gets a placeholder like this anyhow, so this is the smallest box that is possible for this spot if gridspec or subplots has been used for the layout. I do this because if someone has a gap in their layout presumably they want it to be there. And it is needed to keep the axes in rows above or below a blank (for instance) aligned. This is somewhat poorly documented at: https://matplotlib.org/3.1.1/tutorials/intermediate/constrainedlayout_guide.html#empty-gridspec-slots |
Sorry, something went wrong.
|
Yes, I realized that 5 minutes after I posted (see edit above), sorry for the confusion. |
Sorry, something went wrong.
|
Too fast! Though I'll point out that even remove will still put a blank gridspec in there (actually an axes with all the elements made invisible!) |
Sorry, something went wrong.
| pos = ax.get_position(original=True) | ||
| tightbbox = ax.get_tightbbox(renderer=renderer) | ||
| bbox = invTransFig(tightbbox) | ||
| if tightbbox is None: |
There was a problem hiding this comment.
Just:
bbox = pos if tightbbox is None else invTransFig(tightbbox)
Sorry, something went wrong.
There was a problem hiding this comment.
I find those really hard to read a lot of the time.
Sorry, something went wrong.
There was a problem hiding this comment.
Actually, when reading a function for a basic understanding what it does I find this more easy.
It's just one line saying: "Sets bbox depending on some condition". The if/else is already more low level.
But not fighting over this.
Sorry, something went wrong.
There was a problem hiding this comment.
👍 with a comment on the test
Sorry, something went wrong.
|
flake8:
|
Sorry, something went wrong.
Update lib/matplotlib/tests/test_constrainedlayout.py Co-Authored-By: David Stansby <dstansby@gmail.com> FLAKE8
|
Hmmm, I kept trying to rebase that change in, but I suspect I added the space in the "TST" commit, so it kept overwriting it. Ooops.... |
Sorry, something went wrong.
…919-on-v3.1.x Backport PR #14919 on branch v3.1.x (FIX constrained_layout w/ hidden axes)
| Back | FazBrowse Home | New Git URL |
PR Summary
If an axes is hidden (set_visible(False)) then it has no tightbbox. But we still need to position it w/ constrained_layout, pointed out in #14917 (thanks @ImportanceOfBeingErnest )
Closes #14918
PR Checklist