@@ -68,7 +68,7 @@ def adjusted_figsize(w, h, dpi, n):
6868
6969# A registry for available MovieWriter classes
7070class MovieWriterRegistry (object ):
71- '''Registry of of available writer classes by human readable name
71+ '''Registry of available writer classes by human readable name
7272 '''
7373 def __init__ (self ):
7474 self .avail = dict ()
@@ -111,13 +111,14 @@ def list(self):
111111 return list (self .avail .keys ())
112112
113113 def is_available (self , name ):
114- '''If given writer is available
114+ '''Check if given writer is available by name
115115
116116 Parameters
117117 ----------
118118 name : str
119119
120120 Returns
121+ -------
121122 available : bool
122123 '''
123124 self .ensure_not_dirty ()
@@ -141,42 +142,19 @@ class MovieWriter(object):
141142 Attributes
142143 ----------
143144
144- frame_format : string
145+ frame_format : str
145146 The format used in writing frame data, defaults to 'rgba'
146147
147148 fig : `~matplotlib.figure.Figure`
148149 The figure to capture data from.
149- This must be provided by the sub-classes
150-
151- Examples
152- --------
153-
154- Fundamentally, what a MovieWriter does is provide is a way to grab
155- frames by calling grab_frame(). setup() is called to start the
156- process and finish() is called afterwards ::
157-
158- moviewriter = MovieWriter(...)
159- moveiewriter.setup()
160- for j in range(n):
161- update_figure(n)
162- moviewriter.grab_frame()
163- moviewriter.finish()
164-
165-
166- saving() is provided as a context manager to facilitate this process as::
167-
168- with moviewriter.saving('myfile.mp4'):
169- # Iterate over frames
170- moviewriter.grab_frame()
171-
172- The use of the context manager ensures that setup and cleanup are
173- performed as necessary.
150+ This must be provided by the sub-classes.
174151
175152 '''
176153
177154 def __init__ (self , fps = 5 , codec = None , bitrate = None , extra_args = None ,
178155 metadata = None ):
179- '''
156+ '''MovieWriter
157+
180158 Parameters
181159 ----------
182160 fps: int
@@ -371,31 +349,28 @@ class FileMovieWriter(MovieWriter):
371349 This must be sub-classed to be useful.
372350 '''
373351 def __init__ (self , * args , ** kwargs ):
374- '''
375- Parameters
376- ----------
377- fig : `matplotlib.Figure` instance
378- The figure object that contains the information for frames
379- outfile : string
380- The filename of the resulting movie file
381- dpi : int
382- The DPI (or resolution) for the file. This controls the size
383- in pixels of the resulting movie file.
384- frame_prefix : string, optional
385- The filename prefix to use for the temporary files. Defaults
386- to '_tmp'
387- clear_temp : bool
388- Specifies whether the temporary files should be deleted after
389- the movie is written. (Useful for debugging.) Defaults to True.
390-
391- '''
392-
393352 MovieWriter .__init__ (self , * args , ** kwargs )
394353 self .frame_format = rcParams ['animation.frame_format' ]
395354
396355 def setup (self , fig , outfile , dpi , frame_prefix = '_tmp' , clear_temp = True ):
397- '''
398- Perform setup for writing the movie file.
356+ '''Perform setup for writing the movie file.
357+
358+ Parameters
359+ ----------
360+ fig : matplotlib.figure.Figure
361+ The figure to grab the rendered frames from.
362+ outfile : str
363+ The filename of the resulting movie file.
364+ dpi : number
365+ The dpi of the output file. This, with the figure size,
366+ controls the size in pixels of the resulting movie file.
367+ frame_prefix : str, optional
368+ The filename prefix to use for temporary files. Defaults to
369+ '_tmp'.
370+ clear_temp : bool, optional
371+ If the temporary files should be deleted after stitching
372+ the final result. Setting this to `False` can be useful for
373+ debugging. Defaults to `True`.
399374
400375 '''
401376 self .fig = fig
@@ -541,7 +516,7 @@ def output_args(self):
541516# Combine FFMpeg options with pipe-based writing
542517@writers .register ('ffmpeg' )
543518class FFMpegWriter (MovieWriter , FFMpegBase ):
544- '''Pipe based ffmpeg writer.
519+ '''Pipe- based ffmpeg writer.
545520
546521 Frames are streamed directly to ffmpeg via a pipe and written in a single
547522 pass.
@@ -562,7 +537,7 @@ def _args(self):
562537# Combine FFMpeg options with temp file-based writing
563538@writers .register ('ffmpeg_file' )
564539class FFMpegFileWriter (FileMovieWriter , FFMpegBase ):
565- '''File based ffmpeg writer
540+ '''File- based ffmpeg writer
566541
567542 Frames are written to temporary files on disk and then stitched
568543 together at the end.
@@ -595,7 +570,7 @@ class AVConvBase(FFMpegBase):
595570# Combine AVConv options with pipe-based writing
596571@writers .register ('avconv' )
597572class AVConvWriter (AVConvBase , FFMpegWriter ):
598- '''Pipe based avconv writer.
573+ '''Pipe- based avconv writer.
599574
600575 Frames are streamed directly to avconv via a pipe and written in a single
601576 pass.
@@ -605,7 +580,7 @@ class AVConvWriter(AVConvBase, FFMpegWriter):
605580# Combine AVConv options with file-based writing
606581@writers .register ('avconv_file' )
607582class AVConvFileWriter (AVConvBase , FFMpegFileWriter ):
608- '''File based avconv writer
583+ '''File- based avconv writer
609584
610585 Frames are written to temporary files on disk and then stitched
611586 together at the end.
@@ -750,7 +725,7 @@ def isAvailable(cls):
750725# former.
751726@writers .register ('imagemagick' )
752727class ImageMagickWriter (ImageMagickBase , MovieWriter ):
753- '''Pipe based animated gif
728+ '''Pipe- based animated gif
754729
755730 Frames are streamed directly to ImageMagick via a pipe and written
756731 in a single pass.
@@ -770,7 +745,7 @@ def _args(self):
770745# former.
771746@writers .register ('imagemagick_file' )
772747class ImageMagickFileWriter (ImageMagickBase , FileMovieWriter ):
773- '''File based animated gif writer
748+ '''File- based animated gif writer
774749
775750 Frames are written to temporary files on disk and then stitched
776751 together at the end.
@@ -895,7 +870,7 @@ class to use, such as 'ffmpeg' or 'mencoder'. If `None`,
895870 codec : str, optional
896871 the video codec to be used. Not all codecs are supported by
897872 a given :class:`MovieWriter`. If `None`,
898- default to ``rcParams['animation.codec']``
873+ default to ``rcParams['animation.codec']``
899874
900875 bitrate : number, optional
901876 specifies the amount of bits used per second in the
@@ -931,7 +906,7 @@ class to use, such as 'ffmpeg' or 'mencoder'. If `None`,
931906 -----
932907 fps, codec, bitrate, extra_args, metadata are used are used to
933908 construct a :class:`MovieWriter` instance and can only be
934- passed if `writer` is a string. If they are pass as
909+ passed if `writer` is a string. If they are passed as
935910 non-`None` and ``writer`` is a :class:`MovieWriter`, a
936911 `RuntimeError` will be raised.
937912
@@ -1220,15 +1195,15 @@ class TimedAnimation(Animation):
12201195 other needed events.
12211196
12221197 interval : number, optional
1223- Delay between frames. Defaults to 200
1198+ Delay between frames in milliseconds . Defaults to 200.
12241199
12251200 repeat_delay : number, optional
12261201 If the animation in repeated, adds a delay in milliseconds
12271202 before repeating the animation. Defaults to None
12281203
12291204 repeat: bool, optional
12301205 controls whether the animation should repeat when the sequence
1231- of frames is completed.
1206+ of frames is completed. Defaults to `True`.
12321207
12331208 blit : bool, optional
12341209 controls whether blitting is used to optimize drawing. Defaults
@@ -1309,15 +1284,15 @@ class ArtistAnimation(TimedAnimation):
13091284 be disabled for other frames.
13101285
13111286 interval : number, optional
1312- Delay between frames. Defaults to 200
1287+ Delay between frames in miliseconds . Defaults to 200.
13131288
13141289 repeat_delay : number, optional
13151290 If the animation in repeated, adds a delay in milliseconds
1316- before repeating the animation. Defaults to None
1291+ before repeating the animation. Defaults to ` None`.
13171292
13181293 repeat: bool, optional
13191294 controls whether the animation should repeat when the sequence
1320- of frames is completed.
1295+ of frames is completed. Defaults to `True`.
13211296
13221297 blit : bool, optional
13231298 controls whether blitting is used to optimize drawing. Defaults
@@ -1381,7 +1356,6 @@ class FuncAnimation(TimedAnimation):
13811356 other needed events.
13821357
13831358 func : callable
1384-
13851359 The function to call at each frame. The first argument will
13861360 be the next value in ``frames``. Any additional positional
13871361 arguments can be supplied via the ``fargs`` parameter.
@@ -1390,7 +1364,6 @@ class FuncAnimation(TimedAnimation):
13901364
13911365 def func(fr: object, *fargs) -> iterable_of_artists:
13921366
1393-
13941367 frames : iterable, int, generator function, or None, optional
13951368 Source of data to pass ``func`` and each frame of the animation
13961369
@@ -1406,7 +1379,6 @@ def gen_function():
14061379 If `None`, then equivalent to passing ``itertools.count``
14071380
14081381 init_func : callable, optional
1409-
14101382 a function used to draw a clear frame. If not given, the
14111383 results of drawing from the first item in the frames sequence
14121384 will be used. This function will be called once before the
@@ -1426,15 +1398,15 @@ def init_func() -> iterable_of_artists:
14261398 The number of values from `frames` to cache.
14271399
14281400 interval : number, optional
1429- Delay between frames. Defaults to 200
1401+ Delay between frames in milliseconds . Defaults to 200.
14301402
14311403 repeat_delay : number, optional
14321404 If the animation in repeated, adds a delay in milliseconds
1433- before repeating the animation. Defaults to None
1405+ before repeating the animation. Defaults to ` None`.
14341406
14351407 repeat: bool, optional
14361408 controls whether the animation should repeat when the sequence
1437- of frames is completed.
1409+ of frames is completed. Defaults to `True`
14381410
14391411 blit : bool, optional
14401412 controls whether blitting is used to optimize drawing. Defaults
0 commit comments