@@ -590,9 +590,6 @@ def __init__(self, fig, event_source=None, blit=False):
590590 self .frame_seq = self .new_frame_seq ()
591591 self .event_source = event_source
592592
593- # Clear the initial frame
594- self ._init_draw ()
595-
596593 # Instead of starting the event source now, we connect to the figure's
597594 # draw_event, so that we only start once the figure has been drawn.
598595 self ._first_draw_id = fig .canvas .mpl_connect ('draw_event' , self ._start )
@@ -609,15 +606,18 @@ def _start(self, *args):
609606 Starts interactive animation. Adds the draw frame command to the GUI
610607 handler, calls show to start the event loop.
611608 '''
612- # On start, we add our callback for stepping the animation and
613- # actually start the event_source. We also disconnect _start
614- # from the draw_events
615- self .event_source .add_callback (self ._step )
616- self ._init_draw ()
617- self .event_source .start ()
609+ # First disconnect our draw event handler
618610 self ._fig .canvas .mpl_disconnect (self ._first_draw_id )
619611 self ._first_draw_id = None # So we can check on save
620612
613+ # Now do any initial draw
614+ self ._init_draw ()
615+
616+ # Add our callback for stepping the animation and
617+ # actually start the event_source.
618+ self .event_source .add_callback (self ._step )
619+ self .event_source .start ()
620+
621621 def _stop (self , * args ):
622622 # On stop we disconnect all of our events.
623623 if self ._blit :
@@ -1041,7 +1041,7 @@ def _init_draw(self):
10411041
10421042 # Flush the needed axes
10431043 for fig in figs :
1044- fig .canvas .draw ()
1044+ fig .canvas .draw_idle ()
10451045
10461046 def _pre_draw (self , framedata , blit ):
10471047 '''
@@ -1156,8 +1156,9 @@ def _init_draw(self):
11561156 self ._draw_frame (next (self .new_frame_seq ()))
11571157 else :
11581158 self ._drawn_artists = self ._init_func ()
1159- for a in self ._drawn_artists :
1160- a .set_animated (self ._blit )
1159+ if self ._blit :
1160+ for a in self ._drawn_artists :
1161+ a .set_animated (self ._blit )
11611162
11621163 def _draw_frame (self , framedata ):
11631164 # Save the data for potential saving of movies.
@@ -1170,5 +1171,6 @@ def _draw_frame(self, framedata):
11701171 # Call the func with framedata and args. If blitting is desired,
11711172 # func needs to return a sequence of any artists that were modified.
11721173 self ._drawn_artists = self ._func (framedata , * self ._args )
1173- for a in self ._drawn_artists :
1174- a .set_animated (self ._blit )
1174+ if self ._blit :
1175+ for a in self ._drawn_artists :
1176+ a .set_animated (self ._blit )
0 commit comments