Skip to content

Call init draw when restarting and saving the animation. #5740

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
Dec 24, 2015
Merged
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
6 changes: 4 additions & 2 deletions lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -778,8 +778,7 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
with writer.saving(self._fig, filename, dpi):
for anim in all_anim:
# Clear the initial frame
if anim._init_func:
anim._init_draw()
anim._init_draw()
for data in zip(*[a.new_saved_frame_seq()
for a in all_anim]):
for anim, d in zip(all_anim, data):
Expand Down Expand Up @@ -998,6 +997,7 @@ def _step(self, *args):
# back.
still_going = Animation._step(self, *args)
if not still_going and self.repeat:
self._init_draw()
self.frame_seq = self.new_frame_seq()
if self._repeat_delay:
self.event_source.remove_callback(self._step)
Expand Down Expand Up @@ -1168,11 +1168,13 @@ def _init_draw(self):
# artists.
if self._init_func is None:
self._draw_frame(next(self.new_frame_seq()))

else:
self._drawn_artists = self._init_func()
if self._blit:
for a in self._drawn_artists:
a.set_animated(self._blit)
self._save_seq = []

def _draw_frame(self, framedata):
# Save the data for potential saving of movies.
Expand Down