Hi,
I have a problem with updating a figure within a loop. At each iteration I
wish to plot some data as fast as possible, however, only the final plot is
shown while the figure is empty while the looping takes place. Below I have
included a little script that illustrates the problem. Note that the
problem only is apparent when using windows (pythonxy) while it works fine
on my linux installation (kubuntu 12.04).
import numpy as np
import matplotlib.pyplot as plt
##Input
x = np.arange(120.0)*2*np.pi/120.0
x = np.resize(x, (100,120))
y = np.arange(100.0)*2*np.pi/100.0
y = np.resize(y, (120,100))
y = np.transpose(y)
z = np.sin(x) + np.cos(y)
fig,ax = plt.subplots()
im = ax.imshow(z)
fig.show()
for j in range(5000):
x += np.pi/15
y += np.pi/20
z = np.sin(x) + np.cos(y)
im.set_data(z)
fig.canvas.draw()
plt.imshow(z)
plt.show()
Thanks for your help,
Niels
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users