>>>>> "Todd" == Todd G Gardner <piir@...> writes:
Todd> Hello all, Please pardon my ignorance as I am fairly new to
Todd> matplotlib.
Todd> I have 1000 sets of (x,y) data. I would like to cycle
Todd> through this data by graphing set 1 then 2 then ... 1000.
Todd> How can I refresh a plot without closing and reopening that
Todd> plot?
Pekko Piirola <pekko.piirola@...> sent me an example some time
ago that cycles through a data set. Currently this example only works
in the GTK backend, but we're actively working on getting a unified
GUI interface to allow for this kind of thing. You may also want to
take a look at examples/system_monitor.py and examples/dynamic_demo.py
which show how to dynamically update a plot.
#!/usr/bin/env python2.3
import matplotlib.matlab
import gtk
import Numeric
fig = matplotlib.matlab.figure(1)
ind = Numeric.arange(60)
x_tmp=[]
for i in range(100):
x_tmp.append(Numeric.sin((ind+i)*Numeric.pi/15.0))
X=Numeric.array(x_tmp)
lines = matplotlib.matlab.plot(X[:,0],'o')
def updatefig(*args):
updatefig.count += 1
if updatefig.count>59: updatefig.count=0
lines[0].set_data(ind,X[:,updatefig.count])
fig.draw()
return gtk.TRUE
updatefig.count=1
gtk.timeout_add(200,updatefig)
matplotlib.matlab.show()
