Matplotlib - Animations
Given this code snippet, what will be the output when the animation starts?
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
fig, ax = plt.subplots()
line, = ax.plot([], [], 'r-')
xdata, ydata = [], []
def init():
line.set_data([], [])
return line,
def update(frame):
xdata.append(frame)
ydata.append(frame ** 2)
line.set_data(xdata, ydata)
return line,
ani = FuncAnimation(fig, update, frames=range(3), init_func=init, blit=True)
plt.show()