You must store the created Animation in a variable that lives as long as the animation should run. Otherwise, the Animation object will be garbage-collected and the animation stops.
The figure object used to get needed events, such as draw or resize.
The function to call at each frame. The first argument will be the next value in frames. Any additional positional arguments can be supplied via the fargs parameter.
The required signature is:
def func(frame, *fargs) -> iterable_of_artists
If blit == True
, func must return an iterable of all artists that were modified or created. This information is used by the blitting algorithm to determine which parts of the figure have to be updated. The return value is unused if blit == False
and may be omitted in that case.
Source of data to pass func and each frame of the animation
If an iterable, then simply use the values provided. If the iterable has a length, it will override the save_count kwarg.
If an integer, then equivalent to passing range(frames)
If a generator function, then must have the signature:
def gen_function() -> obj
If None, then equivalent to passing itertools.count
.
In all of these cases, the values in frames is simply passed through to the user-supplied func and thus can be of any type.
A function used to draw a clear frame. If not given, the results of drawing from the first item in the frames sequence will be used. This function will be called once before the first frame.
The required signature is:
def init_func() -> iterable_of_artists
If blit == True
, init_func must return an iterable of artists to be re-drawn. This information is used by the blitting algorithm to determine which parts of the figure have to be updated. The return value is unused if blit == False
and may be omitted in that case.
Additional arguments to pass to each call to func.
Fallback for the number of values from frames to cache. This is only used if the number of frames cannot be inferred from frames, i.e. when it's an iterator without length or a generator.
Delay between frames in milliseconds.
The delay in milliseconds between consecutive animation runs, if repeat is True.
Whether the animation repeats when the sequence of frames is completed.
Whether blitting is used to optimize drawing. Note: when using blitting, any animated artists will be drawn according to their zorder; however, they will be drawn on top of any previous artists, regardless of their zorder.
Whether frame data is cached. Disabling cache might be helpful when frames contain large objects.
Makes an animation by repeatedly calling a function func.
The following pages refer to to this document either explicitly or contain code examples using this.
matplotlib.animation.Animation
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them