The following interesting example (random_data.py) is posted at:

http://matplotlib.org/1.4.2/examples/animation/random_data.html


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()

This codes works; but, I am very confused by it. For example:

1. There are 3 positional arguments given for animation.FuncAnimation; but, in 
the
API documentation for this class (http://matplotlib.org/api/animation_api.html), only
two positional arguments are shown.

2. data, the argument to the update function seems to be undefined.

I would appreciate an explanation (in some detail) of how this code actually 
works.
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to