我写了一个python脚本来制作动画但是当我运行它时我得到了错误
AttributeError:'module'对象没有属性'ion'
这是脚本:
import numpy as np
import pylab as pl
data = np.loadtxt( "random.dat" )
pl.ion()
M = len( data[0] )-1
N = len( data[:,0] )
line , = pl.plot( data[0,1:] , pl.ones( M ) , 'o' )
for i in xrange( 1 , N ):
line.set_xdata( data[i,1:] )
pl.title( "t=%.2f" % data[i,0] )
pl.draw()
print "done"
pl.show()
答案 0 :(得分:1)
尝试 pl.pyplot.ion()
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ion