8000 Use np.ndim insteady of np.isscalar. · matplotlib/matplotlib@95a4b41 · GitHub
[go: up one dir, main page]

Skip to content

Commit 95a4b41

Browse files
committed
Use np.ndim insteady of np.isscalar.
1 parent b126ba6 commit 95a4b41

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/matplotlib/image.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ def set_alpha(self, alpha):
293293
self._imcache = None
294294

295295
def _get_scalar_alpha(self):
296-
return self._alpha if np.isscalar(self._alpha) else 1.0
296+
return self._alpha if np.ndim(self._alpha) == 0 else 1.0
297297

298298
def changed(self):
299299
"""
@@ -500,7 +500,7 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
500500
out_alpha[out_mask] = 1
501501
# Apply the pixel-by-pixel alpha values if present
502502
alpha = self.get_alpha()
503-
if alpha is not None and not np.isscalar(alpha):
503+
if alpha is not None and np.ndim(alpha) > 0:
504504
out_alpha *= _resample(self, alpha, out_shape,
505505
t, resample=True)
506506
# mask and run through the norm

0 commit comments

Comments
 (0)
0