Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Better axis limits when using shared axes and empty subplots#2357
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
@@ -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()] |
There was a problem hiding this comment.
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 calculatingnp.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
Looks good. Needs a test -- I don't think it will need to be an image comparison test. |
Added a test |
Ok. 👍 from me, then. Might let this sit for a few days to get other feedback, but this makes sense to me. |
Better axis limits when using shared axes and empty subplots
This is one possible solution to#2356