From a5d532e14a287783517b9bd255e0fca4bf5f077e Mon Sep 17 00:00:00 2001 From: Stephen Sinclair Date: Tue, 22 Sep 2020 11:58:30 +0200 Subject: [PATCH] Call to ExitStack.push should have been ExitStack.callback. In Axes.redraw_in_frame(). Fixes #18539. --- lib/matplotlib/axes/_base.py | 2 +- lib/matplotlib/tests/test_axes.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 40a4af4630b0..4832a2900f19 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -2828,7 +2828,7 @@ def redraw_in_frame(self): with ExitStack() as stack: for artist in [*self._get_axis_list(), self.title, self._left_title, self._right_title]: - stack.push(artist.set_visible, artist.get_visible()) + stack.callback(artist.set_visible, artist.get_visible()) artist.set_visible(False) self.draw(self.figure._cachedRenderer) diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 4a77e792a45b..4b793668ec82 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -6612,6 +6612,13 @@ def test_bbox_aspect_axes_init(): assert_allclose(sizes, sizes[0]) +def test_redraw_in_frame(): + fig, ax = plt.subplots(1, 1) + ax.plot([1, 2, 3]) + fig.canvas.draw() + ax.redraw_in_frame() + + def test_invisible_axes(): # invisible axes should not respond to events... fig, ax = plt.subplots() pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy