From f75ed38efafa7a44c71edb9a1ec5f0f94b33743c Mon Sep 17 00:00:00 2001 From: NikosNikolaidis02 Date: Sun, 18 Jun 2023 11:38:30 +0300 Subject: [PATCH 1/4] Resolving issue #26092 --- lib/matplotlib/image.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 135934a244a8..9aeb33f3deb1 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -553,9 +553,11 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0, else: if A.ndim == 2: # _interpolation_stage == 'rgba' self.norm.autoscale_None(A) - A = self.to_rgba(A) - if A.shape[2] == 3: + A = self.to_rgba(A, alpha=self.get_alpha()) + elif A.shape[2] == 3: A = _rgb_to_rgba(A) + if alpha := self.get_alpha is not None: + A[:, :, 3] = self.get_alpha() alpha = self._get_scalar_alpha() output_alpha = _resample( # resample alpha channel self, A[..., 3], out_shape, t, alpha=alpha) From f673a74ddc1a5f4aef96ce03f1a7a70a77d80874 Mon Sep 17 00:00:00 2001 From: NikosNikolaidis02 Date: Mon, 19 Jun 2023 12:40:58 +0300 Subject: [PATCH 2/4] Fixing issue on testing --- lib/matplotlib/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 9aeb33f3deb1..f0f62db2dd82 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -556,7 +556,7 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0, A = self.to_rgba(A, alpha=self.get_alpha()) elif A.shape[2] == 3: A = _rgb_to_rgba(A) - if alpha := self.get_alpha is not None: + if (alpha := self.get_alpha) is not None: A[:, :, 3] = self.get_alpha() alpha = self._get_scalar_alpha() output_alpha = _resample( # resample alpha channel From 568a52332b29ae423c8edd854b5f42e9b36b9f80 Mon Sep 17 00:00:00 2001 From: NikosNikolaidis02 <92633955+NikosNikolaidis02@users.noreply.github.com> Date: Mon, 19 Jun 2023 16:19:05 +0300 Subject: [PATCH 3/4] Update image.py --- lib/matplotlib/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index f0f62db2dd82..7755bb419efd 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -557,7 +557,7 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0, elif A.shape[2] == 3: A = _rgb_to_rgba(A) if (alpha := self.get_alpha) is not None: - A[:, :, 3] = self.get_alpha() + A[:, :, 3] = self.get_alpha alpha = self._get_scalar_alpha() output_alpha = _resample( # resample alpha channel self, A[..., 3], out_shape, t, alpha=alpha) From 69c177ccb6f5888038e13b6bc1eaa1b34b6dc7a3 Mon Sep 17 00:00:00 2001 From: NikosNikolaidis02 Date: Tue, 20 Jun 2023 20:53:45 +0300 Subject: [PATCH 4/4] Updating testing --- lib/matplotlib/image.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 7755bb419efd..5b1dd732f0e9 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -556,8 +556,8 @@ def _make_image(self, A, in_bbox, out_bbox, clip_bbox, magnification=1.0, A = self.to_rgba(A, alpha=self.get_alpha()) elif A.shape[2] == 3: A = _rgb_to_rgba(A) - if (alpha := self.get_alpha) is not None: - A[:, :, 3] = self.get_alpha + if (alpha := self.get_alpha()) is not None: + A[:, :, 3] = self.get_alpha() alpha = self._get_scalar_alpha() output_alpha = _resample( # resample alpha channel self, A[..., 3], out_shape, t, alpha=alpha)