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