FIX: fallback to viewlims if no data#13588
Conversation
|
This is a bug fix. Could be re-milestoned to 3.1 if it gets in soon... |
| dl.extend(y_finite) | ||
|
|
||
| bb = mtransforms.BboxBase.union(dl) | ||
| vl = mtransforms.BboxBase.union([ax.viewLim for ax in shared]) |
There was a problem hiding this comment.
Optional: Could maybe go into the if.
Disadvantage: Would be duplicated for both ifs.
Advantage: Closer to the place of use. Gets only computed in the rare case that we need it (not that it would be a performance bottle neck.
There was a problem hiding this comment.
Put it in the if and will only get computed once!
|
Flake8: |
5c2d2f3 to
04ff86e
Compare
| vl = mtransforms.BboxBase.union([ax.viewLim for ax in shared]) | ||
| bb.intervalx = vl.intervalx | ||
| if not np.isfinite(bb.intervaly).all(): | ||
| if vl is None: |
There was a problem hiding this comment.
I would have just stupidly recalculated vl. 😄 This only happens for the degenerate case that bb.intevalx and bb.intervaly contain non-finite values. IMHO preferable due to symmetry and simpler logic of the code.
04ff86e to
740dda5
Compare
|
Rebased on master... |
efiring
left a comment
There was a problem hiding this comment.
I don't like the amount of code, both old and new, required in this function to handle odd cases; but it looks like the new part here does what's needed, so it's better than nothing. Maybe @anntzer will see a way to clean it all up and replace a dozen lines with a pair.
|
Sorry, no magic available for you on this snippet right now :) |
…588-on-v3.1.x Backport PR #13588 on branch v3.1.x (FIX: fallback to viewlims if no data)
PR Summary
Closes #11337
The following test would fail because the view limit was set from 0-1:
The issue was in
autoscale_view, which never checked the axes.viewLim, even if the data lim came back undefined. This PR checks the viewlim and uses that if the datalim is not finite.Note this issue is more generic than dates, but is most easily seen there because we can't have dates with ordinal values <1, and the default behaviour made it so such dates were the datalim.
PR Checklist