From 5b0a20b5c3c14a10115989fb32bd906ef1e9c321 Mon Sep 17 00:00:00 2001 From: Eric Larson Date: Mon, 14 Aug 2023 13:12:25 -0400 Subject: [PATCH 1/2] TST: Add failing test --- lib/matplotlib/tests/test_image.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index aeeebd136b65..afbdde032441 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -1076,6 +1076,8 @@ def test_respects_bbox(): # Make the image invisible in axs[1], but visible in axs[0] if we pan # axs[1] up. im.set_clip_box(axs[0].bbox) + # and ndarray should also be okay + im.set_clip_box(np.array(axs[0].bbox)) buf_before = io.BytesIO() fig.savefig(buf_before, format="rgba") assert {*buf_before.getvalue()} == {0xff} # All white. From 2137ad6bfdb6bca12aa9c19f60207eab4b2f516d Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Wed, 16 Aug 2023 10:53:58 +0200 Subject: [PATCH 2/2] Revert identity check --- lib/matplotlib/artist.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index 5c3f6dc5952f..8457544786bd 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -763,10 +763,9 @@ def set_clip_box(self, clipbox): clipping for an artist added to an Axes. """ - if clipbox != self.clipbox: - self.clipbox = clipbox - self.pchanged() - self.stale = True + self.clipbox = clipbox + self.pchanged() + self.stale = True def set_clip_path(self, path, transform=None): """