Skip to content

Commit db67ced

Browse files
authored
Merge pull request #21081 from dstansby/jshtml-doc
Improve docs for to_jshtml()
2 parents de0f2cf + 2ffffb4 commit db67ced

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

doc/api/animation_api.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ to. If you do not hold a reference to the `Animation` object, it (and
3232
hence the timers) will be garbage collected which will stop the
3333
animation.
3434

35-
To save an animation to disk use `Animation.save` or `Animation.to_html5_video`
35+
To save an animation use `Animation.save`, `Animation.to_html5_video`,
36+
or `Animation.to_jshtml`.
3637

3738
See :ref:`ani_writer_classes` below for details about what movie formats are
3839
supported.

lib/matplotlib/animation.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,7 +1299,20 @@ def to_html5_video(self, embed_limit=None):
12991299
return 'Video too large to embed.'
13001300

13011301
def to_jshtml(self, fps=None, embed_frames=True, default_mode=None):
1302-
"""Generate HTML representation of the animation"""
1302+
"""
1303+
Generate HTML representation of the animation.
1304+
1305+
Parameters
1306+
----------
1307+
fps : int, optional
1308+
Movie frame rate (per second). If not set, the frame rate from
1309+
the animation's frame interval.
1310+
embed_frames : bool, optional
1311+
default_mode : str, optional
1312+
What to do when the animation ends. Must be one of ``{'loop',
1313+
'once', 'reflect'}``. Defaults to ``'loop'`` if ``self.repeat``
1314+
is True, otherwise ``'once'``.
1315+
"""
13031316
if fps is None and hasattr(self, '_interval'):
13041317
# Convert interval in ms to frames per second
13051318
fps = 1000 / self._interval

0 commit comments

Comments
 (0)