-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Give AnnotationBbox
an opinion about its extent
#13457
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
Give AnnotationBbox
an opinion about its extent
#13457
Conversation
AnnotationBbox
an opinion about its extent
575a855
to
3993fc5
Compare
You can certainly imagine how 'axes fraction' and constrained layout could get into a bad interaction on dynamic resizing. |
I think any kind of messed up figure would be fine, I was more worried about the flickering. |
I haven’t tested 8000 but I think it’s just jumping between two states |
Well, at least CL gives a warning: |
OK, so 'axes fraction' is impossible unless the offset box is part of the constraint solver from the beginning. Note other co-ordinate systems are fine, but you can't adjust the size of the axes based on elements whose positions are not known until you adjust the size of the axes. If you used the constraint solver inside the offset boxes to make that constraint that could work, but otherwise this won't be compatible with constrained layout. |
3993fc5
to
e14c083
Compare
Ok, let's ignore I added a test. The test fails with |
Are you sure the |
Not sure what would render a renderer incorrect? So here is the problem statement: The following code when run inside this branch is working fine.
It gives this output There is one critical line, which is the saving of the figure to a buffer before calling tight_layout. I can replace savefig by In any case, additing an additional |
e14c083
to
6773da4
Compare
6773da4
to
1c17991
Compare
After rebasing the test fails. Something must have changed in the way tight_layout works between February and now. Any ideas? (I don't think it's possible to bisect with a commit on top, or is it?) |
I think bisect works fine no matter where the commits come from. Not sure what changed. |
80bc6f1
to
74b1c51
Compare
Since tight_layout might be unreliable for artists positionned in axes coordinates anyways, I just put in a smoke test to make sure it doesn't fail. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this get a what's new/change note? I'm undecided.
This needs a rebase if you want it in for 3.3. |
@ImportanceOfBeingErnest any interest in doing the rebase? This can be merged once thats done (modulo a what's new entry?) |
74b1c51
to
01cb983
Compare
This was a simple conflict of two tests being added at the end of a file, so I went ahead and rebased it. If you're alright with that, please can one of you merge it. |
PR Summary
Fixes #12699.
Give
AnnotationBbox
an opinion about its extent, i.e. add aget_window_extent
andget_tightbbox
.This allows e.g. to
savefig
with thebbox_inches='tight'
option and not have the annotations cropped.Before
With this PR
Code
It seems for static figures neither
tight_layout
, norconstrained_layout
are affected by this. But usingconstrained_layout=True
and resizing the figure on screen shows some really weird behaviour.PR Checklist