Skip to content
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

Uses tight_layout.get_subplotspec_list to check if all axes are compatible w/ tight_layout #1170

Merged
merged 2 commits into from Sep 1, 2012

Conversation

leejjoon
Copy link
Contributor

An axes that uses axes_locator (even though the axes itself is not an instance of SubplotBase) can be compatible with tight_layout. This PR suppresses warning message for such case.


subplot_axes = [ax for ax in self.axes if isinstance(ax, SubplotBase)]
if len(subplot_axes) < len(self.axes):
if None in get_subplotspec_list(self.axes):
warnings.warn("tight_layout can only process Axes that descend "
"from SubplotBase; results might be incorrect.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mdboom wanted to replace "descend" with "inherit" in the warning text.. you could change that in this PR so mdboom doesn't have to do it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But with this change, the warning itself is now incorrect and must be fixed. @leejjoon, should it say something like "This figure includes Axes that do not inherit from SubplotBase and/or were not created using axes_locator; tight_layout will not take such Axes into account, so its results might be incorrect."

@efiring
Copy link
Member

efiring commented Aug 30, 2012

Can all this be simplified by having an Axes attribute to indicate whether tight_layout is supported? The attribute would be set to True whenever an operation creates a suitable Axes, or perhaps (if this is possible) modifies an existing Axes in such a way as to support tight_layout?

@leejjoon
Copy link
Contributor Author

While I agree that we need to simplify this, I don't have good solution for now. I will think about it, and any suggestion will be welcomed.

@travisbot
Copy link

This pull request fails (merged 1d80e7f into 94c53e1).

efiring added a commit that referenced this pull request Sep 1, 2012
Uses tight_layout.get_subplotspec_list to check if all axes are compatible w/ tight_layout
@efiring efiring merged commit 2c91aa6 into matplotlib:master Sep 1, 2012
@efiring
Copy link
Member

efiring commented Sep 1, 2012

This is at least an interim solution, so I merged it.

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.

None yet

4 participants