-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Description
Bug report
Bug summary
When calling plt.hist(a), with a containing a np.nan value, the error raised is:
"max must be larger than min in range parameter."
This is confusing especially for novice users unfamiliar with the fact that np.nan>x is True for any number x.
Code for reproduction
import matplotlib.pyplot as plt
import numpy as np
plt.hist([1,2,3,np.nan])Actual outcome
C:\Continuum\Anaconda2\lib\site-packages\numpy\lib\function_base.pyc in histogram(a, bins, range, normed, weights, density)
664 if mn > mx:
665 raise ValueError(
--> 666 'max must be larger than min in range parameter.')
667 if not np.all(np.isfinite([mn, mx])):
668 raise ValueError(
ValueError: max must be larger than min in range parameter.```
Expected outcome
ValueError: values in histogram contains nan```
Matplotlib version
matplotlib version 1.5.3
python version python 2.7 - 1.12.0 for windows 64 bit
- How did you install Matplotlib and Python (pip, anaconda, from source ...)
Anaconda installation