Skip to content

Avoid inverting axes when tight_layout is cramped. #8203

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

Closed
wants to merge 1 commit into from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Mar 6, 2017

I chose to not raise an exception in this case as uncaught exceptions
are fatal for the Qt5 backend.

xref #8062, #8202.

I chose to not raise an exception in this case as uncaught exceptions
are fatal for the Qt5 backend.
@dstansby
Copy link
Member

dstansby commented Mar 6, 2017

Can a test be added for this? Just checking h_axes and v_axes aren't negative should work I think.

@anntzer
Copy link
Contributor Author

anntzer commented Mar 6, 2017

Actually this is inconsistent with the behavior when the figure is too small even in absence of title/labels, which is to raise through SubplotParams.update:

fig, axs = plt.subplots(2, 2, figsize=(.5, .5)); fig.tight_layout()

raises ValueError: bottom cannot be >= top.

The inverted axes behavior only occurs when a title/label is present and the figure otherwise large enough:

fig, axs = plt.subplots(2, 2, figsize=(1, 1)); ax = axs[0, 0]; ax.set(title="foo"); fig.tight_layout()

so it should raise an exception too (... preferably, it should route through the same mechanism). Or the PR that fixes this should also make SubplotParams.update not raise an exception, for consistency.

@anntzer anntzer closed this Mar 6, 2017
@anntzer anntzer deleted the cramped-tight-layout branch April 15, 2017 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants