Error in python script
I wrote a python script to make an animation but when I run it I get the error
AttributeError: 'module' object has no attribute 'ion'
Here is the script:
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(开发者_如何学Python 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()
Try pl.pyplot.ion()
http://matplotlib.sourceforge.net/api/pyplot_api.html#matplotlib.pyplot.ion
精彩评论