Hi guys Im quite a newbie in python/matplotlib.
I am struggling to understand the following animation code on the matplotlib website. How is the data argument in the def update defined if this function is called in animation.FuncAnimation whithout specifying any data as input parameter?
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation
fig, ax = plt.subplots()
line, = ax.plot(np.random.rand(10))
ax.set_ylim(0, 1)
def update(data):
line.set_ydata(data)
return line,
def data_gen():
while True:
yield np.random.rand(10)
ani = animation.FuncAnimation(fig, update, data_gen, interval=100)
plt.show()