From a1caf126acc37b958b3151bb79eba45ec4ccbf86 Mon Sep 17 00:00:00 2001 From: AASMA GUPTA Date: Sat, 30 Aug 2025 05:36:38 +0530 Subject: [PATCH 1/4] Fix SVG rendering error in _setup_plot_projector --- lib/matplotlib/widgets.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 034a9b4db7a0..e84faebab0bb 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -2172,6 +2172,11 @@ def update_background(self, event): # `release` can call a draw event even when `ignore` is True. if not self.useblit: return + # Skip blitting if we are saving to disk or if the backend doesn’t support it + if getattr(self.canvas, "_is_saving", False): + return + if not hasattr(self.canvas, "copy_from_bbox"): + return # Make sure that widget artists don't get accidentally included in the # background, by re-rendering the background if needed (and then # re-re-rendering the canvas with the visible widget artists). From 48d979316f3a4b6aec9479b032687a9d5466774c Mon Sep 17 00:00:00 2001 From: Aasma Gupta Date: Mon, 1 Sep 2025 02:48:54 +0530 Subject: [PATCH 2/4] Update lib/matplotlib/widgets.py Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- lib/matplotlib/widgets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index e84faebab0bb..14df27dedeba 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -2173,7 +2173,7 @@ def update_background(self, event): if not self.useblit: return # Skip blitting if we are saving to disk or if the backend doesn’t support it - if getattr(self.canvas, "_is_saving", False): + if self.canvas.is_saving(): return if not hasattr(self.canvas, "copy_from_bbox"): return From 98ca7bb3daadcdd6386a0a46b41c01cc8d1f884d Mon Sep 17 00:00:00 2001 From: Aasma Gupta Date: Tue, 2 Sep 2025 00:55:14 +0530 Subject: [PATCH 3/4] Removed redundant check(self.useblit already checks) Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- lib/matplotlib/widgets.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 14df27dedeba..a6ca6ad09771 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -2175,8 +2175,6 @@ def update_background(self, event): # Skip blitting if we are saving to disk or if the backend doesn’t support it if self.canvas.is_saving(): return - if not hasattr(self.canvas, "copy_from_bbox"): - return # Make sure that widget artists don't get accidentally included in the # background, by re-rendering the background if needed (and then # re-re-rendering the canvas with the visible widget artists). From 913e52829834e9b284cc55ebf65bfb4b75c218ac Mon Sep 17 00:00:00 2001 From: Aasma Gupta Date: Tue, 2 Sep 2025 02:02:40 +0530 Subject: [PATCH 4/4] Update lib/matplotlib/widgets.py Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- lib/matplotlib/widgets.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index a6ca6ad09771..f4adcd60f6cb 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -2172,9 +2172,8 @@ def update_background(self, event): # `release` can call a draw event even when `ignore` is True. if not self.useblit: return - # Skip blitting if we are saving to disk or if the backend doesn’t support it if self.canvas.is_saving(): - return + return # saving does not use blitting # Make sure that widget artists don't get accidentally included in the # background, by re-rendering the background if needed (and then # re-re-rendering the canvas with the visible widget artists).