Skip to content

Commit a5d532e

Browse files
committed
Call to ExitStack.push should have been ExitStack.callback.
In Axes.redraw_in_frame(). Fixes matplotlib#18539.
1 parent 1e19aa8 commit a5d532e

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2828,7 +2828,7 @@ def redraw_in_frame(self):
28282828
with ExitStack() as stack:
28292829
for artist in [*self._get_axis_list(),
28302830
self.title, self._left_title, self._right_title]:
2831-
stack.push(artist.set_visible, artist.get_visible())
2831+
stack.callback(artist.set_visible, artist.get_visible())
28322832
artist.set_visible(False)
28332833
self.draw(self.figure._cachedRenderer)
28342834

lib/matplotlib/tests/test_axes.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6612,6 +6612,13 @@ def test_bbox_aspect_axes_init():
66126612
assert_allclose(sizes, sizes[0])
66136613

66146614

6615+
def test_redraw_in_frame():
6616+
fig, ax = plt.subplots(1, 1)
6617+
ax.plot([1, 2, 3])
6618+
fig.canvas.draw()
6619+
ax.redraw_in_frame()
6620+
6621+
66156622
def test_invisible_axes():
66166623
# invisible axes should not respond to events...
66176624
fig, ax = plt.subplots()

0 commit comments

Comments
 (0)