Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 103d839

Browse files
authored
Merge pull request #11267 from maahn/fixHistNan
FIX: allow nan values in data for plt.hist
2 parents ff67864 + 11cecfe commit 103d839

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6160,8 +6160,8 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
61606160
xmax = -np.inf
61616161
for xi in x:
61626162
if len(xi) > 0:
6163-
xmin = min(xmin, xi.min())
6164-
xmax = max(xmax, xi.max())
6163+
xmin = min(xmin, np.nanmin(xi))
6164+
xmax = max(xmax, np.nanmax(xi))
61656165
bin_range = (xmin, xmax)
61666166
density = bool(density) or bool(normed)
61676167
if density and not stacked:

0 commit comments

Comments
 (0)