8000 BUG: Mask nans in fill_between(x) · matplotlib/matplotlib@4a882dc · GitHub
[go: up one dir, main page]

Skip to content

Commit 4a882dc

Browse files
committed
BUG: Mask nans in fill_between(x)
1 parent c981774 commit 4a882dc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/axes.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6736,8 +6736,8 @@ def fill_between(self, x, y1, y2=0, where=None, interpolate=False,
67366736
if not (x.shape == y1.shape == y2.shape == where.shape):
67376737
raise ValueError("Argument dimensions are incompatible")
67386738

6739-
mask = reduce(ma.mask_or,
6740-
[ma.getmask(x), ma.getmask(y1), ma.getmask(y2)])
6739+
mask = reduce(ma.mask_or, [f(a) for f in (ma.getmask, np.isnan)
6740+
for a in (x, y1, y2)])
67416741
if mask is not ma.nomask:
67426742
where &= ~mask
67436743

@@ -6870,8 +6870,8 @@ def fill_betweenx(self, y, x1, x2=0, where=None, **kwargs):
68706870
if not (y.shape == x1.shape == x2.shape == where.shape):
68716871
raise ValueError("Argument dimensions are incompatible")
68726872

6873-
mask = reduce(ma.mask_or,
6874-
[ma.getmask(y), ma.getmask(x1), ma.getmask(x2)])
6873+
mask = reduce(ma.mask_or, [f(a) for f in (ma.getmask, np.isnan)
6874+
for a in (y, x1, x2)])
68756875
if mask is not ma.nomask:
68766876
where &= ~mask
68776877

0 commit comments

Comments
 (0)
0