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

Better axis limits when using shared axes and empty subplots #2357

Merged
merged 1 commit into from Aug 31, 2013

Conversation

ChrisBeaumont
Copy link
Contributor

This is one possible solution to #2356

@@ -1895,6 +1895,10 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True):
if scalex and self._autoscaleXon:
xshared = self._shared_x_axes.get_siblings(self)
dl = [ax.dataLim for ax in xshared]
#ignore non-finite data limits if good limits exist
if any(np.isfinite(d).all() for d in dl):
dl = [d for d in dl if np.isfinite(d).all()]
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if there's a way to do this without calculating np.isfinite(d).all() twice for each element. Maybe something like:

finite_dl = [d for d in dl if np.isfinite(d).all()]
if len(finite_dl):
    dl = finite_dl

@mdboom
Copy link
Member

mdboom commented Aug 30, 2013

Looks good. Needs a test -- I don't think it will need to be an image comparison test.

@ChrisBeaumont
Copy link
Contributor Author

Added a test

@mdboom
Copy link
Member

mdboom commented Aug 30, 2013

Ok. 👍 from me, then. Might let this sit for a few days to get other feedback, but this makes sense to me.

dmcdougall added a commit that referenced this pull request Aug 31, 2013
Better axis limits when using shared axes and empty subplots
@dmcdougall dmcdougall merged commit a091f6d into matplotlib:master Aug 31, 2013
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

3 participants