Skip to content

Avoid inverting axes when tight_layout is cramped. - #8203

Closed
anntzer wants to merge 1 commit into
matplotlib:masterfrom
anntzer:cramped-tight-layout
Closed

anntzer wants to merge 1 commit into
matplotlib:masterfrom
anntzer:cramped-tight-layout

Conversation

@anntzer

@anntzer anntzer commented Mar 6, 2017

Copy link
Copy Markdown
Contributor

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

dstansby commented Mar 6, 2017

Copy link
Copy Markdown
Member

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

@anntzer

anntzer commented Mar 6, 2017 •

Copy link
Copy Markdown
Contributor Author

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