I\'ve been trying for hours to get this simple script working, but nothing I do seems to help. It\'s a slight modification of the most basic animated plot sample code from t
Here's how you'd do it in python 3:
import matplotlib
matplotlib.use('TkAgg') # Qt4Agg gives an empty, black window
import matplotlib.pylab as plt
import time
# create initial plot
z = zeros(10)
line, = plot(z)
ylim(-3, 3)
for i in range(60):
print('frame:', i)
d = randn(10)
line.set_ydata(d)
draw()
#replace time.sleep() with plt.pause()
plt.pause(0.5)
I got rid of the call to ion() and hold(False). I also replaced time.sleep with plt.pause