Skip to content

Commit 44230b5

Browse files
committed
Mask non-positive values on log scale using NaNs rather than masked arrays.
1 parent 6931619 commit 44230b5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/matplotlib/scale.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,12 @@ def get_transform(self):
8787
def _mask_non_positives(a):
8888
"""
8989
Return a Numpy masked array where all non-positive values are
90-
masked. If there are no non-positive values, the original array
91-
is returned.
90+
replaced with NaNs. If there are no non-positive values, the
91+
original array is returned.
9292
"""
9393
mask = a <= 0.0
9494
if mask.any():
95-
return ma.MaskedArray(a, mask=mask)
95+
return np.where(mask, np.nan, a)
9696
return a
9797

9898

0 commit comments

Comments
 (0)