[Matplotlib-users] What is Artist._animated used for in Matplotlib
Yuri Sukhov
yuri.sukhov at gmail.com
Mon Feb 6 15:14:44 EST 2017
Hi all,
I am writing my own Animation class for Matplotlib in order to use
event-based animation and it's unclear how Artist._animated and associated
set_animated() function affect rendering.
My animation should use blitting and I took existing FuncAnimation class as
a reference for my implementation. In this class _init_draw and _draw_frame
methods, among other things, set _animated = True for each artist in
self._drawn_artists if blitting is enabled:
for a in self._drawn_artists:
a.set_animated(self._blit)
What is the reason for this operation? In what cases Artist._animated is
used, and how it affects rendering with or without blitting? I have tested
my implementation and I don't see any difference in behaviour with or
without set_animated():
class DataAnimation(Animation):
def __init__(self, fig, *args, **kwargs):
super(DataAnimation, self).__init__(fig, event_source=event_source,
*args, **kwargs)
def new_frame_seq(self):
return itertools.count()
def _init_draw(self):
self._drawn_artists = plot.init()
for artist in self._drawn_artists: # <- do we need this?
artist.set_animated(self._blit)
def _draw_frame(self, frame_data):
self._drawn_artists = plot.updated_artists
for artist in self._drawn_artists: # <- do we need this?
artist.set_animated(self._blit)
Thanks!
Yuri.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20170206/d9d52a95/attachment.html>
More information about the Matplotlib-users
mailing list