问题
Does imshow animation work with the qt-backend? The following works fine in non-qt but does not animate using qt - just shows the last frame:
img = standard_normal((40,40))
image =imshow(img,interpolation='nearest',animated=True)
for k in range(1,10):
img = standard_normal((40,40))
image.set_data(img)
draw()
回答1:
You either need to add a pause
in the loop after the draw or use the matplotlib.animation
module (doc) (tutorial).
possibly related matplotlib.pyplot/pylab not updating figure while isinteractive(), using ipython -pylab:
回答2:
I'll take a look at that but it looks like for using the qt backend the call to:
QApplication.ProcessEvents()
updates the imshow plot.
来源:https://stackoverflow.com/questions/13595566/matplotlib-qt-imshow-animate