0
0
Matplotlibdata~10 mins

Saving animations (GIF, MP4) in Matplotlib - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to save the animation as a GIF file.

Matplotlib
ani.save('animation.[1]', writer='pillow')
Drag options to blanks, or click blank then click option'
Aavi
Bmp4
Cgif
Dmov
Attempts:
3 left
💡 Hint
Common Mistakes
Using '.mp4' extension with 'pillow' writer causes errors.
Forgetting to specify the correct file extension.
2fill in blank
medium

Complete the code to save the animation as an MP4 file using the 'ffmpeg' writer.

Matplotlib
ani.save('animation.mp4', writer='[1]')
Drag options to blanks, or click blank then click option'
Affmpeg
Bimagemagick
Cpillow
Davconv
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pillow' writer for MP4 files causes errors.
Using 'imagemagick' which is for GIF or other formats.
3fill in blank
hard

Fix the error in the code to save the animation as MP4 with 30 frames per second.

Matplotlib
ani.save('animation.mp4', writer='ffmpeg', fps=[1])
Drag options to blanks, or click blank then click option'
A15
B30
C'30'
D60
Attempts:
3 left
💡 Hint
Common Mistakes
Passing fps as a string causes a type error.
Using too low fps makes animation choppy.
4fill in blank
hard

Fill both blanks to save the animation as a GIF with 15 frames per second.

Matplotlib
ani.save('animation.[1]', writer='[2]', fps=15)
Drag options to blanks, or click blank then click option'
Agif
Bmp4
Cpillow
Dffmpeg
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'ffmpeg' writer with '.gif' extension causes errors.
Using '.mp4' extension with 'pillow' writer is incorrect.
5fill in blank
hard

Fill all three blanks to save the animation as MP4 with 24 frames per second and a bitrate of 1800.

Matplotlib
ani.save('animation.[1]', writer='[2]', fps=[3], bitrate=1800)
Drag options to blanks, or click blank then click option'
Agif
Bmp4
Cffmpeg
Dpillow
E24
F30
G15
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'pillow' writer for MP4 files causes errors.
Setting fps as a string instead of an integer.