-
-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Closed
Labels
Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues
Milestone
Description
In [1]: plt.hist(np.arange(10), range=(0, np.inf))
# empty plot
Out[1]:
(array([ 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.]),
array([ nan, inf, inf, inf, inf, inf, inf, inf, inf, inf, inf]),
<a list of 10 Patch objects>)
In [2]: plt.hist(np.arange(10), range=(0, np.inf), histtype="step")
---------------------------------------------------------------------------
UnboundLocalError Traceback (most recent call last)
<ipython-input-2-1921805d8f19> in <module>()
----> 1 plt.hist(np.arange(10), range=(0, np.inf), histtype="step")
/usr/lib/python3.5/site-packages/matplotlib/pyplot.py in hist(x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, hold, **kwargs)
2894 histtype=histtype, align=align, orientation=orientation,
2895 rwidth=rwidth, log=log, color=color, label=label,
-> 2896 stacked=stacked, **kwargs)
2897 draw_if_interactive()
2898 finally:
/usr/lib/python3.5/site-packages/matplotlib/axes/_axes.py in hist(self, x, bins, range, normed, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, **kwargs)
5872 ymin = np.amin(m[m != 0])
5873 # filter out the 0 height bins
-> 5874 ymin = max(ymin*0.9, minimum)
5875 ymin = min(ymin0, ymin)
5876 self.dataLim.intervaly = (ymin, ymax)
UnboundLocalError: local variable 'ymin' referenced before assignmentObviously there's isn't much to do here other than improving the error reporting in the second case.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Difficulty: Easyhttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issueshttps://matplotlib.org/devdocs/devel/contribute.html#good-first-issues