import pandas as pd
import numpy as np
from plotnine import ggplot, aes, geom_path, theme, theme_void, lims
from plotnine.animation import PlotnineAnimation
# for animation in the notebook
from matplotlib import rc
rc("animation", html="html5") plotnine.animation.PlotnineAnimation
PlotnineAnimation(
plots, interval=200, repeat_delay=None, repeat=True, blit=False
)Animation using ggplot objects
Parameters
plots : Iterable[ggplot]-
ggplot objects that make up the the frames of the animation
interval : int = 200-
Delay between frames in milliseconds. Defaults to 200.
repeat_delay : int = None-
If the animation in repeated, adds a delay in milliseconds before repeating the animation. Defaults to
None. repeat : bool = True-
Controls whether the animation should repeat when the sequence of frames is completed. Defaults to
True. blit : bool = False-
Controls whether blitting is used to optimize drawing. Defaults to
False.
Notes
- The plots should have the same
facetand the facet should not have fixed x and y scales. - The scales of all the plots should have the same limits. It is a good idea to create a scale (with limits) for each aesthetic and add them to all the plots.
