@@ -59,9 +59,9 @@ supported.
59
59
The inner workings of `FuncAnimation ` is more-or-less::
60
60
61
61
for d in frames:
62
- artists = func(d, *fargs)
63
- fig.canvas.draw_idle()
64
- fig.canvas.start_event_loop(interval)
62
+ artists = func(d, *fargs)
63
+ fig.canvas.draw_idle()
64
+ fig.canvas.start_event_loop(interval)
65
65
66
66
with details to handle 'blitting' (to dramatically improve the live
67
67
performance), to be non-blocking, not repeatedly start/stop the GUI
@@ -211,16 +211,18 @@ debug.
211
211
FFMpegFileWriter
212
212
ImageMagickFileWriter
213
213
214
- Fundamentally, a `MovieWriter ` provides a way to grab sequential frames
215
- from the same underlying `~matplotlib.figure.Figure ` object. The base
216
- class `MovieWriter ` implements 3 methods and a context manager. The
217
- only difference between the pipe-based and file-based writers is in the
218
- arguments to their respective ``setup `` methods.
214
+ The writer classes provide a way to grab sequential frames from the same
215
+ underlying `~matplotlib.figure.Figure `. They all provide three methods that
216
+ must be called in sequence:
219
217
220
- The ``setup() `` method is used to prepare the writer (possibly opening
221
- a pipe), successive calls to ``grab_frame() `` capture a single frame
222
- at a time and ``finish() `` finalizes the movie and writes the output
223
- file to disk
10000
. For example ::
218
+ - `~.AbstractMovieWriter.setup ` prepares the writer (e.g. opening a pipe).
219
+ Pipe-based and file-based writers take different arguments to ``setup() ``.
220
+ - `~.AbstractMovieWriter.grab_frame ` can then be called as often as
221
+ needed to capture a single frame at a time
222
+ - `~.AbstractMovieWriter.finish ` finalizes the movie and writes the output
223
+ file to disk.
224
+
225
+ Example::
224
226
225
227
moviewriter = MovieWriter(...)
226
228
moviewriter.setup(fig, 'my_movie.ext', dpi=100)
@@ -230,14 +232,14 @@ file to disk. For example ::
230
232
moviewriter.finish()
231
233
232
234
If using the writer classes directly (not through `Animation.save `), it is
233
- strongly encouraged to use the `~MovieWriter. saving ` context manager ::
235
+ strongly encouraged to use the `~.AbstractMovieWriter. saving ` context manager::
234
236
235
237
with moviewriter.saving(fig, 'myfile.mp4', dpi=100):
236
238
for j in range(n):
237
239
update_figure(j)
238
240
moviewriter.grab_frame()
239
241
240
- to ensures that setup and cleanup are performed as necessary.
242
+ to ensure that setup and cleanup are performed as necessary.
241
243
242
244
Examples
243
245
--------
0 commit comments