Skip to content

Commit 774b54d

Browse files
committed
DOC MEP12 - converted animation to SG/MEP12 compatible
1 parent 3127815 commit 774b54d

File tree

4 files changed

+43
-4
lines changed

4 files changed

+43
-4
lines changed

examples/animation/animate_decay.py

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
"""
2+
=====
3+
Decay
4+
=====
5+
6+
This example showcases a sinusoidal decay animation.
7+
"""
8+
9+
110
import numpy as np
211
import matplotlib.pyplot as plt
312
import matplotlib.animation as animation

examples/animation/basic_example.py

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
"""
2+
=========================
3+
Simple animation examples
4+
=========================
5+
6+
This example contains two animations. The first is a random walk plot. the
7+
second is an image animation.
8+
"""
9+
110
import numpy as np
211
import matplotlib.pyplot as plt
312
import matplotlib.animation as animation
@@ -17,7 +26,8 @@ def update_line(num, data, line):
1726
plt.title('test')
1827
line_ani = animation.FuncAnimation(fig1, update_line, 25, fargs=(data, l),
1928
interval=50, blit=True)
20-
#line_ani.save('lines.mp4')
29+
30+
# To save the animation, use the command: line_ani.save('lines.mp4')
2131

2232
fig2 = plt.figure()
2333

@@ -30,6 +40,7 @@ def update_line(num, data, line):
3040

3141
im_ani = animation.ArtistAnimation(fig2, ims, interval=50, repeat_delay=3000,
3242
blit=True)
33-
#im_ani.save('im.mp4', metadata={'artist':'Guido'})
43+
# To save this second animation with some metadata, use the following command:
44+
# im_ani.save('im.mp4', metadata={'artist':'Guido'})
3445

3546
plt.show()

examples/animation/basic_example_writer.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
# Same as basic_example, but writes files using a single MovieWriter instance
2-
# without putting on screen
1+
"""
2+
===================
3+
Saving an animation
4+
===================
5+
6+
This example showcases the same animations as `basic_example.py`, but instead
7+
of displaying the animation to the user, it writes to files using a
8+
MovieWriter instance.
9+
"""
10+
311
# -*- noplot -*-
412
import numpy as np
513
import matplotlib

examples/animation/bayes_update.py

+11
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
"""
2+
================
3+
The Bayes update
4+
================
5+
6+
This animation displays the posterior estimate updates as it is refitted when
7+
new data arrives.
8+
The vertical line represents the theoretical value to which the plotted
9+
distribution should converge.
10+
"""
11+
112
# update a distribution based on new data.
213
import numpy as np
314
import matplotlib.pyplot as plt

0 commit comments

Comments
 (0)