You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Animation doesn't work in matplotlib with QtAgg backend. You should call QApplication.processEvents(), in draw() for that backend.
from PyQt4.QtGui import QApplication
import matplotlib
from pylab import *
from time import *
x = arange(5)
y = arange(5)
ion()
hold(False)
plot(x,y)
z = array(transpose(matrix(y))*matrix(x))
p = imshow(z)
for i in xrange(5):
z = z + 2
p.set_data(z)
clim()
draw()
QApplication.processEvents() #otherwise animation freezes. draw() should call that.
print "step"
sleep(1)
This is not really a bug, and I don't think the suggested change is needed.
You can use gcf().canvas.flush_events() to force the event loop to run.
draw() is calling update(), which is what it should do. The real problem is
that this is not a good way to try to do animation. To make simple
pyplot-level animation easier, I have made a new pause() function which I
think provides a reasonably clean solution.
Activity
efiring commentedon Jun 21, 2011
This is not really a bug, and I don't think the suggested change is needed.
You can use gcf().canvas.flush_events() to force the event loop to run.
draw() is calling update(), which is what it should do. The real problem is
that this is not a good way to try to do animation. To make simple
pyplot-level animation easier, I have made a new pause() function which I
think provides a reasonably clean solution.