8000 Backport PR #12478: MAINT: numpy deprecates asscalar in 1.16 · matplotlib/matplotlib@939ebbe · GitHub
[go: up one dir, main page]

Skip to content

Commit 939ebbe

Browse files
anntzerMeeseeksDev[bot]
authored and
MeeseeksDev[bot]
committed
Backport PR #12478: MAINT: numpy deprecates asscalar in 1.16
1 parent 0ab7214 commit 939ebbe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/matplotlib/colors.py

+1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def _sanitize_extrema(ex):
9191
if ex is None:
9292
return ex
9393
try:
94-
ret = np.asscalar(ex)
94+
ret = ex.item()
9595
except AttributeError:
9696
ret = float(ex)
9797
return ret

lib/matplotlib/image.py

Lines changed: 3 additions & 3 deletions
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)
0