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

Skip to content

Call to ExitStack.push should have been ExitStack.callback. #18540

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
7 changes: 7 additions & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down