1
- ======================
2
- `` animation `` module
3
- ======================
1
+ *********
2
+ animation
3
+ *********
4
4
5
5
.. automodule :: matplotlib.animation
6
6
:no-members:
11
11
:local:
12
12
:backlinks: entry
13
13
14
-
15
14
Animation
16
15
=========
17
16
@@ -37,7 +36,6 @@ To save an animation to disk use `Animation.save` or `Animation.to_html5_video`
37
36
See :ref: `ani_writer_classes ` below for details about what movie formats are
38
37
supported.
39
38
40
-
41
39
``FuncAnimation ``
42
40
-----------------
43
41
@@ -48,7 +46,6 @@ The inner workings of `FuncAnimation` is more-or-less::
48
46
fig.canvas.draw_idle()
49
47
fig.canvas.start_event_loop(interval)
50
48
51
-
52
49
with details to handle 'blitting' (to dramatically improve the live
53
50
performance), to be non-blocking, not repeatedly start/stop the GUI
54
51
event loop, handle repeats, multiple animated axes, and easily save
@@ -122,54 +119,40 @@ artist at a global scope and let Python sort things out. For example ::
122
119
init_func=init, blit=True)
123
120
plt.show()
124
121
125
-
126
122
The second method is to us `functools.partial ` to 'bind' artists to
127
123
function. A third method is to use closures to build up the required
128
124
artists and functions. A fourth method is to create a class.
129
125
130
-
131
-
132
-
133
126
Examples
134
127
~~~~~~~~
135
128
136
129
.. toctree ::
137
130
:maxdepth: 1
138
131
139
132
../gallery/animation/animate_decay
140
- ../gallery/animation/bayes_update_sgskip
141
- ../gallery/animation/double_pendulum_animated_sgskip
142
- ../gallery/animation/dynamic_image
133
+ ../gallery/animation/bayes_update
134
+ ../gallery/animation/double_pendulum_sgskip
143
135
../gallery/animation/histogram
144
136
../gallery/animation/rain
145
- ../gallery/animation/random_data
146
- ../gallery/animation/simple_3danim
137
+ ../gallery/animation/random_walk
147
138
../gallery/animation/simple_anim
148
- ../gallery/animation/strip_chart_demo
139
+ ../gallery/animation/strip_chart
149
140
../gallery/animation/unchained
150
141
151
142
``ArtistAnimation ``
152
143
-------------------
153
144
154
-
155
145
Examples
156
146
~~~~~~~~
157
147
158
148
.. toctree ::
159
149
:maxdepth: 1
160
150
161
- ../gallery/animation/basic_example
162
- ../gallery/animation/basic_example_writer_sgskip
163
- ../gallery/animation/dynamic_image2
164
-
165
-
166
-
151
+ ../gallery/animation/dynamic_image
167
152
168
153
Writer Classes
169
154
==============
170
155
171
-
172
-
173
156
The provided writers fall into two broad categories: pipe-based and
174
157
file-based. The pipe-based writers stream the captured frames over a
175
158
pipe to an external process. The pipe-based variants tend to be more
@@ -179,7 +162,6 @@ performant, but may not work on all systems.
179
162
:toctree: _as_gen
180
163
:nosignatures:
181
164
182
-
183
165
FFMpegWriter
184
166
ImageMagickFileWriter
185
167
AVConvWriter
@@ -196,7 +178,6 @@ slower, these writers can be easier to debug.
196
178
ImageMagickWriter
197
179
AVConvFileWriter
198
180
199
-
200
181
Fundamentally, a `MovieWriter ` provides a way to grab sequential frames
201
182
from the same underlying `~matplotlib.figure.Figure ` object. The base
202
183
class `MovieWriter ` implements 3 methods and a context manager. The
@@ -215,45 +196,39 @@ file to disk. For example ::
215
196
moviewriter.grab_frame()
216
197
moviewriter.finish()
217
198
218
-
219
- If using the writer classes directly (not through `Animation.save `), it is strongly encouraged
220
- to use the `~MovieWriter.saving ` context manager ::
199
+ If using the writer classes directly (not through `Animation.save `), it is
200
+ strongly encouraged to use the `~MovieWriter.saving ` context manager ::
221
201
222
202
with moviewriter.saving(fig, 'myfile.mp4', dpi=100):
223
203
for j in range(n):
224
204
update_figure(n)
225
205
moviewriter.grab_frame()
226
206
227
-
228
207
to ensures that setup and cleanup are performed as necessary.
229
208
209
+ Examples
210
+ --------
230
211
231
- :ref: `sphx_glr_gallery_animation_moviewriter_sgskip.py `
212
+ .. toctree ::
213
+ :maxdepth: 1
232
214
215
+ ../gallery/animation/frame_grabbing_sgskip
233
216
234
217
.. _ani_writer_classes :
235
218
236
219
Helper Classes
237
220
==============
238
221
239
-
240
222
Animation Base Classes
241
223
----------------------
242
224
243
-
244
225
.. autosummary ::
245
226
:toctree: _as_gen
246
227
:nosignatures:
247
228
248
229
Animation
249
230
TimedAnimation
250
231
251
-
252
- Custom Animation classes
253
- ------------------------
254
-
255
- :ref: `sphx_glr_gallery_animation_subplots.py `
256
-
257
232
Writer Registry
258
233
---------------
259
234
@@ -280,7 +255,7 @@ To reduce code duplication base classes
280
255
MovieWriter
281
256
FileMovieWriter
282
257
283
- and mixins are provided
258
+ and mixins
284
259
285
260
.. autosummary ::
286
261
:toctree: _as_gen
@@ -290,9 +265,9 @@ and mixins are provided
290
265
FFMpegBase
291
266
ImageMagickBase
292
267
293
- See the source code for how to easily implement new `MovieWriter `
294
- classes.
268
+ are provided.
295
269
270
+ See the source code for how to easily implement new `MovieWriter ` classes.
296
271
297
272
Inheritance Diagrams
298
273
====================
0 commit comments