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

Skip to content
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
5 changes: 3 additions & 2 deletions lib/matplotlib/backend_bases.py
Original file line number Diff line number Diff line change
Expand Up @@ -2068,8 +2068,9 @@ def print_figure(self, filename, dpi=None, facecolor=None, edgecolor=None,
# Some code (e.g. Figure.show) differentiates between having *no*
# manager and a *None* manager, which should be fixed at some point,
# but this should be fine.
with cbook._setattr_cm(self, _is_saving=True, manager=None), \
cbook._setattr_cm(self.figure, dpi=dpi):
with cbook._setattr_cm(self, manager=None), \
cbook._setattr_cm(self.figure, dpi=dpi), \
cbook._setattr_cm(canvas, _is_saving=True):

if facecolor is None:
facecolor = rcParams['savefig.facecolor']
Expand Down
9 changes: 9 additions & 0 deletions lib/matplotlib/tests/test_figure.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,3 +487,12 @@ def test_removed_axis():
fig, axs = plt.subplots(2, sharex=True)
axs[0].remove()
fig.canvas.draw()


@check_figures_equal(extensions=["svg", "pdf", "eps", "png"])
def test_animated_with_canvas_change(fig_test, fig_ref):
ax_ref = fig_ref.subplots()
ax_ref.plot(range(5))

ax_test = fig_test.subplots()
ax_test.plot(range(5), animated=True)