animate module
We built postmd.animate
module to help to animate the data. This module
is based on the matplotlib.animation.FuncAnimation
class.
We provided two methods to preview and save the animation.
- show()
: preview the animation.
- save()
: save the animation to a file(git
, mp4
, or avi
).
We provide two derived classes: AppendAnimate
and CumAnimate
.
Note
We have initialized self.fig, self.ax = plt.subplots()
in the base class Animate
.
Therefore, you can use self.fig
and self.ax
to customize the figure of animation.
See Example for more details.
Customize
The Base class is Animate
class. The following method may be overrided in the derived class:
_init(self)
: initialize the data inself.ax
_update_data(self,n)
: tellFuncAnimation
how to update the data inself.ax
.n
means the n-th frame in the animation. Should return(xdata,ydata)
._update_frame(self,n)
: tellFuncAnimation
how to update the frame in the animation.n
means the n-th frame in the animation. Usually, there is no need to override this method.