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

Skip to content

Commit 80909e5

Browse files
committed
MNT: simplify creation of output array
1 parent b6f17f3 commit 80909e5

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/matplotlib/image.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,8 +390,6 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
390390
mask = A.mask
391391
# ~A.mask # masked data
392392
A = rgba
393-
output = np.zeros((out_height, out_width, 4),
394-
dtype=A.dtype)
395393
alpha = 1.0
396394
created_rgba_mask = True
397395
else:
@@ -414,12 +412,12 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0,
414412
elif A.shape[2] != 4:
415413
raise ValueError("Invalid dimensions, got %s" % (A.shape,))
416414

417-
output = np.zeros((out_height, out_width, 4), dtype=A.dtype)
418-
419415
alpha = self.get_alpha()
420416
if alpha is None:
421417
alpha = 1.0
422418

419+
output = np.zeros((out_height, out_width, 4), dtype=A.dtype)
420+
423421
_image.resample(
424422
A, output, t, _interpd_[self.get_interpolation()],
425423
self.get_resample(), alpha,

0 commit comments

Comments
 (0)