@@ -1014,7 +1014,8 @@ def _stop(self, *args):
10141014 def save (self , filename , writer = None , fps = None , dpi = None , codec = None ,
10151015 bitrate = None , extra_args = None , metadata = None , extra_anim = None ,
10161016 savefig_kwargs = None ):
1017- '''Saves a movie file by drawing every frame.
1017+ """
1018+ Save the animation as a movie file by drawing every frame.
10181019
10191020 Parameters
10201021 ----------
@@ -1025,7 +1026,7 @@ def save(self, filename, writer=None, fps=None, dpi=None, codec=None,
10251026 writer : :class:`MovieWriter` or str, optional
10261027 A `MovieWriter` instance to use or a key that identifies a
10271028 class to use, such as 'ffmpeg'. If ``None``, defaults to
1028- :rc:`animation.writer`.
1029+ :rc:`animation.writer` = 'ffmpeg' .
10291030
10301031 fps : number, optional
10311032 Frames per second in the movie. Defaults to ``None``, which will use
@@ -1039,13 +1040,13 @@ class to use, such as 'ffmpeg'. If ``None``, defaults to
10391040 codec : str, optional
10401041 The video codec to be used. Not all codecs are supported
10411042 by a given :class:`MovieWriter`. If ``None``, default to
1042- :rc:`animation.codec`.
1043+ :rc:`animation.codec` = 'h264' .
10431044
10441045 bitrate : number, optional
10451046 Specifies the number of bits used per second in the compressed
10461047 movie, in kilobits per second. A higher number means a higher
10471048 quality movie, but at the cost of increased file size. If ``None``,
1048- defaults to :rc:`animation.bitrate`.
1049+ defaults to :rc:`animation.bitrate` = -1 .
10491050
10501051 extra_args : list, optional
10511052 List of extra string arguments to be passed to the underlying movie
@@ -1070,13 +1071,12 @@ class to use, such as 'ffmpeg'. If ``None``, defaults to
10701071
10711072 Notes
10721073 -----
1073- fps, codec, bitrate, extra_args, metadata are used to
1074- construct a :class:`MovieWriter` instance and can only be
1075- passed if `writer` is a string. If they are passed as
1076- non-`None` and ``writer`` is a :class:`MovieWriter`, a
1077- `RuntimeError` will be raised.
1074+ *fps*, *codec*, *bitrate*, *extra_args* and *metadata* are used to
1075+ construct a `.MovieWriter` instance and can only be passed if
1076+ *writer* is a string. If they are passed as non-*None* and *writer*
1077+ is a `.MovieWriter`, a `RuntimeError` will be raised.
10781078
1079- '''
1079+ """
10801080 # If the writer is None, use the rc param to find the name of the one
10811081 # to use
10821082 if writer is None :
@@ -1194,12 +1194,12 @@ def _step(self, *args):
11941194 return False
11951195
11961196 def new_frame_seq (self ):
1197- '''Creates a new sequence of frame information.'''
1197+ """Return a new sequence of frame information."""
11981198 # Default implementation is just an iterator over self._framedata
11991199 return iter (self ._framedata )
12001200
12011201 def new_saved_frame_seq (self ):
1202- '''Creates a new sequence of saved/cached frame information.'''
1202+ """Return a new sequence of saved/cached frame information."""
12031203 # Default is the same as the regular frame sequence
12041204 return self .new_frame_seq ()
12051205
@@ -1293,14 +1293,30 @@ def _end_redraw(self, evt):
12931293 self ._handle_resize )
12941294
12951295 def to_html5_video (self , embed_limit = None ):
1296- '''Returns animation as an HTML5 video tag.
1296+ """
1297+ Convert the animation to an HTML5 ``<video>`` tag.
12971298
12981299 This saves the animation as an h264 video, encoded in base64
12991300 directly into the HTML5 video tag. This respects the rc parameters
13001301 for the writer as well as the bitrate. This also makes use of the
13011302 ``interval`` to control the speed, and uses the ``repeat``
13021303 parameter to decide whether to loop.
1303- '''
1304+
1305+ Parameters
1306+ ----------
1307+ embed_limit : float, optional
1308+ Limit, in MB, of the returned animation. No animation is created
1309+ if the limit is exceeded.
1310+ Defaults to :rc:`animation.embed_limit` = 20.0.
1311+
1312+ Returns
1313+ -------
1314+ video_tag : str
1315+ An HTML5 video tag with the animation embedded as base64 encoded
1316+ h264 video.
1317+ If the *embed_limit* is exceeded, this returns the string
1318+ "Video too large to embed."
1319+ """
13041320 VIDEO_TAG = r'''<video {size} {options}>
13051321 <source type="video/mp4" src="data:video/mp4;base64,{video}">
13061322 Your browser does not support the video tag.
@@ -1550,8 +1566,8 @@ def _draw_frame(self, artists):
15501566
15511567
15521568class FuncAnimation (TimedAnimation ):
1553- '''
1554- Makes an animation by repeatedly calling a function `` func`` .
1569+ """
1570+ Makes an animation by repeatedly calling a function * func* .
15551571
15561572 Parameters
15571573 ----------
@@ -1561,26 +1577,32 @@ class FuncAnimation(TimedAnimation):
15611577
15621578 func : callable
15631579 The function to call at each frame. The first argument will
1564- be the next value in `` frames`` . Any additional positional
1565- arguments can be supplied via the `` fargs`` parameter.
1580+ be the next value in * frames* . Any additional positional
1581+ arguments can be supplied via the * fargs* parameter.
15661582
15671583 The required signature is::
15681584
1569- def func(frame, *fargs) -> iterable_of_artists:
1585+ def func(frame, *fargs) -> iterable_of_artists
1586+
1587+ If ``blit == True``, *func* must return an iterable of all artists
1588+ that were modified or created. This information is used by the blitting
1589+ algorithm to determine which parts of the figure have to be updated.
1590+ The return value is unused if ``blit == False`` and may be omitted in
1591+ that case.
15701592
15711593 frames : iterable, int, generator function, or None, optional
1572- Source of data to pass `` func`` and each frame of the animation
1594+ Source of data to pass * func* and each frame of the animation
15731595
1574- If an iterable, then simply use the values provided. If the
1575- iterable has a length, it will override the `` save_count`` kwarg.
1596+ - If an iterable, then simply use the values provided. If the
1597+ iterable has a length, it will override the * save_count* kwarg.
15761598
1577- If an integer, then equivalent to passing ``range(frames)``
1599+ - If an integer, then equivalent to passing ``range(frames)``
15781600
1579- If a generator function, then must have the signature::
1601+ - If a generator function, then must have the signature::
15801602
1581- def gen_function() -> obj:
1603+ def gen_function() -> obj
15821604
1583- If `` None`` , then equivalent to passing ``itertools.count``.
1605+ - If * None* , then equivalent to passing ``itertools.count``.
15841606
15851607 In all of these cases, the values in *frames* is simply passed through
15861608 to the user-supplied *func* and thus can be of any type.
@@ -1591,12 +1613,15 @@ def gen_function() -> obj:
15911613 will be used. This function will be called once before the
15921614 first frame.
15931615
1594- If ``blit == True``, ``init_func`` must return an iterable of artists
1595- to be re-drawn.
1596-
15971616 The required signature is::
15981617
1599- def init_func() -> iterable_of_artists:
1618+ def init_func() -> iterable_of_artists
1619+
1620+ If ``blit == True``, *init_func* must return an iterable of artists
1621+ to be re-drawn. This information is used by the blitting
1622+ algorithm to determine which parts of the figure have to be updated.
1623+ The return value is unused if ``blit == False`` and may be omitted in
1624+ that case.
16001625
16011626 fargs : tuple or None, optional
16021627 Additional arguments to pass to each call to *func*.
@@ -1609,19 +1634,19 @@ def init_func() -> iterable_of_artists:
16091634
16101635 repeat_delay : number, optional
16111636 If the animation in repeated, adds a delay in milliseconds
1612- before repeating the animation. Defaults to `` None`` .
1637+ before repeating the animation. Defaults to * None* .
16131638
16141639 repeat : bool, optional
16151640 Controls whether the animation should repeat when the sequence
1616- of frames is completed. Defaults to `` True`` .
1641+ of frames is completed. Defaults to * True* .
16171642
16181643 blit : bool, optional
16191644 Controls whether blitting is used to optimize drawing. Note: when using
16201645 blitting any animated artists will be drawn according to their zorder.
16211646 However, they will be drawn on top of any previous artists, regardless
1622- of their zorder. Defaults to ``False``.
1647+ of their zorder. Defaults to *False*.
1648+ """
16231649
1624- '''
16251650 def __init__ (self , fig , func , frames = None , init_func = None , fargs = None ,
16261651 save_count = None , ** kwargs ):
16271652 if fargs :
0 commit comments