-
-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
TST/FIX twinx and twiny w/ constrainedlayout #10407
Conversation
1572a0b
to
085068f
Compare
It's too bad this was not noticed before, but you should probably use |
Do you mean |
Not specified defaults to classic, or we'd have to recreate all the test images. |
I can do that for the two that aren't merged here. Happy to do it for the other ones as well, but there will still be dupes in the repo. |
085068f
to
98bfb26
Compare
Actually, removed the images. Not really needed for the test, which is just that the axes track each other.... Happy to change the other (already committed) image tests if thats warranted. |
98bfb26
to
1f3b65f
Compare
ax2 = ax.twinx() | ||
example_plot(ax) | ||
example_plot(ax2, fontsize=24) | ||
fig.draw(fig.canvas.get_renderer()) |
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.
fig.canvas.draw()
is what's used elsewhere.
The images are already there, so I guess there's no saving in changing the style now. Just best to remember it the next time they're updated. |
1f3b65f
to
8940210
Compare
codecov says the line with the undefined name is not getting hit with these new tests. |
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.
I can run the tests without the import and it still passes, so it seems they are not checking that code just yet.
Great catch @QuLogic Thanks a lot. That code path was never getting called, because only the What really has me flummoxed is that twinx works w/o that logic. I added to subplot anyway, because I think its important to keep a layoutbox with each axis. But it never got into the situation where that was causing a problem. |
a45da54
to
be3f489
Compare
Small fix - the layout box in the twinned axis was already being made, so this just constrains it to be the same size as its twin. This was already happening due to logic @efiring added, but this makes it explicit in the layout constraints, which seems a good idea if things get complicated. |
Thanks again for your help @QuLogic I'd missed that that code wasn't even being called. |
PR Summary
As per #10404, the
twinx/y
code in_base.py
for constrainedlayout was not being called in any of the tests, and hence an import was inadvertently erased. This adds the import and two tests. I also tested interactively, and everything works as it should to window resizing.PR Checklist