-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
constrained_layout fails on suptitle+colorbars+some figure sizes #17712
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
Comments
I don't get this with either macOSx or qt5Agg on my mac. I don't understand what could cause this, or why the order would make a difference (the subtitle gets placed the same regardless). |
@anntzer are you using a tiling window manager? I have seen issues with tiling managers some getting out of sync with figure sizes. That said, with qtile I can not reproduce this. |
No, I am using a boring defaultish KDE.
|
I don't get this with #17494 either. It changes how colorbars are handled, so maybe worth checking out |
#17494 appears to fix the problem; I guess that's a good argument in favor of it :) |
Curious. OTOH I can't get this at all, using F, or maximizing w/ the green dot, so I can't really help. I would guess its something wrong w/ how your window manager reports back sizes when at full screen, but not sure? |
I can reproduce this, and #17494 does fix both maximizing and fullscreen. |
Actually, this is independent of fullscreening and just depends on the actual aspect ratio of the window (and thus indirectly on the aspect ratio of a full-screen window, with or without the titlebar as that is removed by "F"): I can repro the same issue with just from pylab import *
fig = plt.figure(figsize=(8, 4), constrained_layout=True) # <- note the change in size
fig.suptitle("foo")
axs = fig.subplots(1, 2, sharex=True, sharey=True)
im = axs[0].imshow([[1, 2], [3, 4]])
fig.colorbar(im, ax=axs[0], orientation="horizontal")
im = axs[1].imshow([[1, 2], [3, 4]])
fig.colorbar(im, ax=axs[1], orientation="horizontal")
plt.show() and no window size manipulation. (The fact that the result depends on whether suptitle() is called first or last remains, though.) With #17494 I now get a different issue wrt colorbars: |
OK, fair enough - I can reproduce that. I guess we just have very different aspect ratio screens. Not sure we should fix this since there is an easy work around, and I'd prefer to get #17494 to work. WRT the overlapping colorbars, I can work on that in the context of #17494.... Colorbars are the hardest thing about the layout managers. |
Bug report
Bug summary
After
and toggling manually to fullscreen, one gets

i.e. the suptitle is placed too low.
Note that this doesn't happen if the call to suptitle() comes last instead of first.
Matplotlib version
print(matplotlib.get_backend())
): gui+agg/mplcairoThe text was updated successfully, but these errors were encountered: