Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 62297d1

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

File tree

Expand file treeCollapse file tree

2 files changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-4
lines changed

‎lib/matplotlib/colors.py

Copy file name to clipboardExpand all lines: lib/matplotlib/colors.py
+1-1Lines 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

Copy file name to clipboardExpand all lines: lib/matplotlib/image.py
+3-3Lines 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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.