Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9c9a660

Browse files
authored
Merge pull request #12509 from meeseeksmachine/auto-backport-of-pr-12478-on-v3.0.x
Backport PR #12478 on branch v3.0.x (MAINT: numpy deprecates asscalar in 1.16)
2 parents 0ab7214 + 939ebbe commit 9c9a660

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/matplotlib/colors.py

Lines 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)