Skip to content

Commit 1e160aa

Browse files
committed
MNT: support old versions of numpy
Numpy 1.7 does not support `np.nanmin` and `np.nanmax` on masked arrays (instead of returning a number it returns a MaskedIterator).
1 parent f8e00bb commit 1e160aa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/image.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,10 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
372372
scaled_dtype = A.dtype
373373
else:
374374
scaled_dtype = np.float32
375-
a_min = np.nanmin(A)
376-
a_max = np.nanmax(A)
375+
# old versions of numpy do not work with `np.nammin`
376+
# and `np.nanmax` as inputs
377+
a_min = np.ma.min(A)
378+
a_max = np.ma.max(A)
377379
# scale the input data to [.1, .9]. The Agg
378380
# interpolators clip to [0, 1] internally, use a
379381
# smaller input scale to identify which of the

0 commit comments

Comments
 (0)