0
0
Matplotlibdata~10 mins

Why animations show change over time in Matplotlib - Test Your Understanding

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

Complete the code to import the animation module from matplotlib.

Matplotlib
from matplotlib import [1]
Drag options to blanks, or click blank then click option'
Apyplot
Banimation
Cstyle
Dcolors
Attempts:
3 left
💡 Hint
Common Mistakes
Importing pyplot instead of animation
Forgetting to import animation module
2fill in blank
medium

Complete the code to create a figure object for the animation.

Matplotlib
fig = plt.[1]()
Drag options to blanks, or click blank then click option'
Afigure
Bscatter
Cplot
Dshow
Attempts:
3 left
💡 Hint
Common Mistakes
Using plt.plot() instead of plt.figure()
Using plt.show() which only displays the plot
3fill in blank
hard

Fix the error in the animation function call to update the plot over time.

Matplotlib
ani = animation.FuncAnimation(fig, [1], frames=100, interval=50)
Drag options to blanks, or click blank then click option'
Aupdate_plot
Bplt.plot
Cshow
Ddraw
Attempts:
3 left
💡 Hint
Common Mistakes
Passing plt.plot instead of an update function
Passing plt.show which does not update frames
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that stores squares of numbers greater than 3.

Matplotlib
squares = {word: [1] for word in words if len(word) [2] 3}
Drag options to blanks, or click blank then click option'
Alen(word)
B>
C<
Dword
Attempts:
3 left
💡 Hint
Common Mistakes
Using the word itself instead of its length
Using less than instead of greater than
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension filtering items with positive values and uppercase keys.

Matplotlib
result = {{ [1]: [2] for k, v in data.items() if v [3] 0 }}
Drag options to blanks, or click blank then click option'
Ak.upper()
Bv
C>
Dk.lower()
Attempts:
3 left
💡 Hint
Common Mistakes
Using lowercase keys instead of uppercase
Using less than or equal instead of greater than