8000 Backport PR #12478: MAINT: numpy deprecates asscalar in 1.16 (#12508) · matplotlib/matplotlib@62297d1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 62297d1

Browse files
meeseeksmachinetimhoffm
authored andcommitted
Backport PR #12478: MAINT: numpy deprecates asscalar in 1.16 (#12508)
1 parent 6c2eda1 commit 62297d1

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
@@ -98,7 +98,7 @@ def _sanitize_extrema(ex):
9898
if ex is None:
9999
return ex
100100
try:
101-
ret = np.asscalar(ex)
101+
ret = ex.item()
102102
except AttributeError:
103103
ret = float(ex)
104104
return ret

lib/matplotlib/image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,9 +421,9 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
421421

422422
A_scaled -= a_min
423423
# a_min and a_max might be ndarray subclasses so use
424-
# asscalar to avoid errors
425-
a_min = np.asscalar(a_min.astype(scaled_dtype))
426-
a_max = np.asscalar(a_max.astype(scaled_dtype))
424+
# item to avoid errors
425+
a_min = a_min.astype(scaled_dtype).item()
426+
a_max = a_max.astype(scaled_dtype).item()
427427

428428
if a_min != a_max:
429429
A_scaled /= ((a_max - a_min) / 0.8)

0 commit comments

Comments
 (0)
0