Skip to content

Commit 1c32411

Browse files
committed
Add note on keeping a reference to animation docstrings
1 parent 07145c2 commit 1c32411

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lib/matplotlib/animation.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,12 @@ class Animation:
882882
This class is not usable as is, and should be subclassed to provide needed
883883
behavior.
884884
885+
.. note::
886+
887+
You must store the created Animation in a variable that lives as long
888+
as the animation should run. Otherwise, the Animation object will be
889+
garbage-collected and the animation stops.
890+
885891
Parameters
886892
----------
887893
fig : `~matplotlib.figure.Figure`
@@ -1394,6 +1400,12 @@ class TimedAnimation(Animation):
13941400
13951401
A new frame is drawn every *interval* milliseconds.
13961402
1403+
.. note::
1404+
1405+
You must store the created Animation in a variable that lives as long
1406+
as the animation should run. Otherwise, the Animation object will be
1407+
garbage-collected and the animation stops.
1408+
13971409
Parameters
13981410
----------
13991411
fig : `~matplotlib.figure.Figure`
@@ -1462,6 +1474,12 @@ class ArtistAnimation(TimedAnimation):
14621474
Before creating an instance, all plotting should have taken place
14631475
and the relevant artists saved.
14641476
1477+
.. note::
1478+
1479+
You must store the created Animation in a variable that lives as long
1480+
as the animation should run. Otherwise, the Animation object will be
1481+
garbage-collected and the animation stops.
1482+
14651483
Parameters
14661484
----------
14671485
fig : `~matplotlib.figure.Figure`
@@ -1529,6 +1547,12 @@ class FuncAnimation(TimedAnimation):
15291547
"""
15301548
Makes an animation by repeatedly calling a function *func*.
15311549
1550+
.. note::
1551+
1552+
You must store the created Animation in a variable that lives as long
1553+
as the animation should run. Otherwise, the Animation object will be
1554+
garbage-collected and the animation stops.
1555+
15321556
Parameters
15331557
----------
15341558
fig : `~matplotlib.figure.Figure`

0 commit comments

Comments
 (0)