Complete the code to import the function needed to create dynamic plots.
from matplotlib.animation import [1]
The FuncAnimation function from matplotlib.animation is used to create dynamic plots that update over time.
Complete the code to create a figure and axis for plotting.
fig, ax = plt.[1]()The subplots() function creates a figure and axes objects, which are needed for plotting and animation.
Fix the error in the update function to correctly update the line data.
def update(frame): y = [i**2 for i in range(frame)] line.set_data(range(frame), [1]) return line,
The set_data method needs both x and y data. Here, x is range(frame) and y is the list y calculated in the function.
Fill both blanks to create the animation object with the correct figure and update function.
ani = FuncAnimation([1], [2], frames=10, interval=200)
The FuncAnimation needs the figure object and the update function to animate the plot.
Fill all three blanks to set the x and y limits and start the animation.
ax.set_xlim(0, [1]) ax.set_ylim(0, [2]) plt.[3]()
Set the x-axis limit to 10, y-axis limit to 100, and call plt.show() to display the animation.