Skip to content

Commit 2980184

Browse files
authored
Merge pull request #12478 from ksunden/asscalar_dep
MAINT: numpy deprecates asscalar in 1.16
2 parents ff53308 + 73c22bc commit 2980184

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/matplotlib/colors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def _sanitize_extrema(ex):
107107
if ex is None:
108108
return ex
109109
try:
110-
ret = np.asscalar(ex)
110+
ret = ex.item()
111111
except AttributeError:
112112
ret = float(ex)
113113
return ret

lib/matplotlib/image.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,9 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
411411

412412
A_scaled -= a_min
413413
# a_min and a_max might be ndarray subclasses so use
414-
# asscalar to avoid errors
415-
a_min = np.asscalar(a_min.astype(scaled_dtype))
416-
a_max = np.asscalar(a_max.astype(scaled_dtype))
414+
# item to avoid errors
415+
a_min = a_min.astype(scaled_dtype).item()
416+
a_max = a_max.astype(scaled_dtype).item()
417417

418418
if a_min != a_max:
419419
A_scaled /= ((a_max - a_min) / 0.8)

0 commit comments

Comments
 (0)