Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit beacf38

Browse files
authored
Merge pull request #18540 from radarsat1/fix-redraw-in-frame
Call to ExitStack.push should have been ExitStack.callback.
2 parents 8fa61a4 + a5d532e commit beacf38

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
@@ -2845,7 +2845,7 @@ def redraw_in_frame(self):
28452845
with ExitStack() as stack:
28462846
for artist in [*self._get_axis_list(),
28472847
self.title, self._left_title, self._right_title]:
2848-
stack.push(artist.set_visible, artist.get_visible())
2848+
stack.callback(artist.set_visible, artist.get_visible())
28492849
artist.set_visible(False)
28502850
self.draw(self.figure._cachedRenderer)
28512851

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)