| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
|
||
| if dmin < 1: | ||
| raise ValueError('datalim minimum {} < 1. This often ' | ||
| 'happens if you pass a float to an ' |
There was a problem hiding this comment.
indent
Sorry, something went wrong.
| raise ValueError('cannot convert {} < 1 to a date. This ' | ||
| 'often happens if floats are passed to ' | ||
| 'a Matplotlib axis that expects datetime objects. ' | ||
| ''.format(ix)) |
There was a problem hiding this comment.
you don't need the '', starting the line with a dot binds to the string on the previous line
Sorry, something went wrong.
| if ix < 1: | ||
| raise ValueError('cannot convert {} < 1 to a date. This ' | ||
| 'often happens if floats are passed to ' | ||
| 'a Matplotlib axis that expects datetime objects. ' |
There was a problem hiding this comment.
to an axis (no need to mpl, which you also did not include below)
Sorry, something went wrong.
There was a problem hiding this comment.
minor formatting/wording can be improved but nothing blocking
Sorry, something went wrong.
|
|
||
| if dmin < 1: | ||
| raise ValueError('datalim minimum {} < 1. This often ' | ||
| 'happens if you pass a float to an ' |
There was a problem hiding this comment.
Can "float" be change to something less technical like "number" or "normal number"?
Sorry, something went wrong.
There was a problem hiding this comment.
value that is not a datetime?
Sorry, something went wrong.
|
(apart from my suggested change I am +10000 on this, since I remember in my early Matplotlib days spending ages meaning what on earth the current error message meant) |
Sorry, something went wrong.
|
Yep I’ll fix it this pm. No problem making it even clearer. |
Sorry, something went wrong.
|
Done - I couldn't get a test to work, however. 🐑 If I do: g, ax = plt.subplots()
ax.plot(datetime(2017, 1, 1), 1)
ax.plot(1, 1)
fig.draw(fig.canvas.get_renderer())I get the error. Trying to do this in dates_test.py I get: def test_bad_datetime():
with pytest.raises(ValueError):
fig, ax = plt.subplots()
ax.plot(datetime.datetime(2017, 1, 1), 1)
ax.plot(1, 1)
> fig.draw(fig.canvas.get_renderer())
E Failed: DID NOT RAISE <class 'ValueError'>
|
Sorry, something went wrong.
|
|
||
| ix = int(x) | ||
| if ix < 1: | ||
| raise ValueError('cannot convert {} < 1 to a date. This ' |
There was a problem hiding this comment.
I think should be:
cannot convert {} to a date
{} < 1 evaluate to a bool 😉
Sorry, something went wrong.
There was a problem hiding this comment.
OK. Changed to
'view limit minimum {} is less than 1 and '
'is an invalid Matplotlib date value. This '
'often happens if you pass a non-datetime '
'value to an axis that has datetime units'
.format(vmin))
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
#9211 points out that the error message after
yields the mysterious error:
This PR catches earlier and returns:
PR Checklist