Repository navigation
FIX: fail early for non-finite figure sizes - #8647
Merged
Merged
Conversation
QuLogic
reviewed
May 20, 2017
| frameon = rcParams['figure.frameon'] | ||
|
|
||
| self.bbox_inches = Bbox.from_bounds(0, 0, *figsize) | ||
| if not all(np.isfinite(_) for _ in figsize): |
Member
There was a problem hiding this comment.
Why not check this before the expense of creating a Bbox (not that I know if that's a very large expense or not)?
Contributor
There was a problem hiding this comment.
You can just write np.isfinite(figsize).all() (and similarly below): the ufunc will cast the input to an ndarray.
| if h is None: | ||
| w, h = w | ||
|
|
||
| if not all(np.isfinite(_) for _ in (h, w)): |
Member
There was a problem hiding this comment.
Really picky, but it's kind of weird to have it be h, w when everything around it is w, h.
tacaswell
force-pushed
the
fix_invalid_figsize
branch
from
May 22, 2017 03:40
bef16b4 to
a4999ac
Compare
anntzer
reviewed
May 22, 2017
| if h is None: | ||
| w, h = w | ||
|
|
||
| if not all(np.isfinite(_) for _ in (w, h)): |
Member
Author
There was a problem hiding this comment.
not convinced going through numpy is better in this case.
anntzer
approved these changes
May 23, 2017
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #8640
PR Summary
If passed non-finite values to figure size or add_axes, raise immediately rather than at draw time.
PR Checklist