animatplot.Animation¶
-
class
animatplot.Animation(blocks, timeline=None, fig=None)[source]¶ The foundation of all animations.
Parameters: - blocks (list of animatplot.animations.Block) – A list of blocks to be animated
- timeline (Timeline or 1D array, optional) – If an array is passed in, it will be converted to a Timeline. If not given, a timeline will be created using the length of the first block.
- fig (matplotlib figure, optional) – The figure that the animation is to occur on
-
animation¶ a matplotlib animation returned from FuncAnimation
Methods
__init__Initialize self. controlsCreates interactive controls for the animation saveSaves an animation save_gifSaves the animation to a gif timeline_sliderCreates a timeline slider. toggleCreates a play/pause button to start/stop the animation -
__init__(blocks, timeline=None, fig=None)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
controls(timeline_slider_args={}, toggle_args={})[source]¶ Creates interactive controls for the animation
Creates both a play/pause button, and a time slider at once
Parameters: - timeline_slider_args (Dict, optional) – A dictionary of arguments to be passed to timeline_slider()
- toggle_args (Dict, optional) – A dictionary of argyments to be passed to toggle()
-
save(*args, **kwargs)[source]¶ Saves an animation
A wrapper around
matplotlib.animation.Animation.save()
-
save_gif(filename)[source]¶ Saves the animation to a gif
A convience function. Provided to let the user avoid dealing with writers.
Parameters: filename (str) – the name of the file to be created without the file extension
-
timeline_slider(text='Time', ax=None, valfmt='%1.2f', color=None, axis=None)[source]¶ Creates a timeline slider.
Parameters: - text (str, optional) – The text to display for the slider. Defaults to ‘Time’
- ax (matplotlib.axes.Axes, optional) – The matplotlib axes to attach the slider to.
- valfmt (str, optional) – a format specifier used to print the time Defaults to ‘%1.2f’
- color – The color of the slider.