I'm trying to make an animation with matplotlib. The problem:
whenever I try to rescale or move the plot with the buttons of
plotting window, the animation stops. My system is Debian Woody and
python-2.3 with matplotlib-0.32. I'm a total newbie with matplotlib
(I installed it yesterday), so what am I doing wrong? An example code
below:
------------------------------------------
#!/usr/bin/env python2.3
import matplotlib.matl ab
import gtk
import Numeric
fig = matplotlib.matl ab.figure(1)
ind = Numeric.arange( 60)
x_tmp=[]
for i in range(100):
x_tmp.append(Nu meric.sin((ind+ i)*Numeric.pi/15.0))
X=Numeric.array (x_tmp)
lines = matplotlib.matl ab.plot(X[:,0],'o')
def updatefig(*args ):
updatefig.count += 1
if updatefig.count >59: updatefig.count =0
lines[0].set_data(ind,X[:,updatefig.cou nt])
fig.draw()
return gtk.TRUE
updatefig.count =-1
gtk.timeout_add (200,updatefig)
matplotlib.matl ab.show()
-------------------------------------------------
--
Best regards,
Pekko
whenever I try to rescale or move the plot with the buttons of
plotting window, the animation stops. My system is Debian Woody and
python-2.3 with matplotlib-0.32. I'm a total newbie with matplotlib
(I installed it yesterday), so what am I doing wrong? An example code
below:
------------------------------------------
#!/usr/bin/env python2.3
import matplotlib.matl ab
import gtk
import Numeric
fig = matplotlib.matl ab.figure(1)
ind = Numeric.arange( 60)
x_tmp=[]
for i in range(100):
x_tmp.append(Nu meric.sin((ind+ i)*Numeric.pi/15.0))
X=Numeric.array (x_tmp)
lines = matplotlib.matl ab.plot(X[:,0],'o')
def updatefig(*args ):
updatefig.count += 1
if updatefig.count >59: updatefig.count =0
lines[0].set_data(ind,X[:,updatefig.cou nt])
fig.draw()
return gtk.TRUE
updatefig.count =-1
gtk.timeout_add (200,updatefig)
matplotlib.matl ab.show()
-------------------------------------------------
--
Best regards,
Pekko
Comment