From 1c3241137a1180086c4db0bb06ee2f45da80d3cb Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Wed, 4 Nov 2020 23:17:58 +0100 Subject: [PATCH] Add note on keeping a reference to animation docstrings --- lib/matplotlib/animation.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 4edeb05ae4bc..ee9609cc2892 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -882,6 +882,12 @@ class Animation: This class is not usable as is, and should be subclassed to provide needed behavior. + .. note:: + + 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. + Parameters ---------- fig : `~matplotlib.figure.Figure` @@ -1394,6 +1400,12 @@ class TimedAnimation(Animation): A new frame is drawn every *interval* milliseconds. + .. note:: + + 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. + Parameters ---------- fig : `~matplotlib.figure.Figure` @@ -1462,6 +1474,12 @@ class ArtistAnimation(TimedAnimation): Before creating an instance, all plotting should have taken place and the relevant artists saved. + .. note:: + + 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. + Parameters ---------- fig : `~matplotlib.figure.Figure` @@ -1529,6 +1547,12 @@ class FuncAnimation(TimedAnimation): """ Makes an animation by repeatedly calling a function *func*. + .. note:: + + 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. + Parameters ---------- fig : `~matplotlib.figure.Figure`