Skip to content

Commit 07f0dee

Browse files
committed
MNT: use more explicit check that xmin/xmax are not NaN
1 parent ea06df8 commit 07f0dee

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6669,7 +6669,9 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
66696669
if len(xi):
66706670
xmin = min(xmin, np.nanmin(xi))
66716671
xmax = max(xmax, np.nanmax(xi))
6672-
if xmax > xmin:
6672+
# make sure we have at least one non-nan value
6673+
# before we
6674+
if np.isfinite([xmin, xmax]).all():
66736675
bin_range = (xmin, xmax)
66746676

66756677
# If bins are not specified either explicitly or via range,

0 commit comments

Comments
 (0)