updating an image plot

Hi,
I am trying to update the image plotted in a figure. From what I understood, this code should do the job:

import pylab as p

image=p.zeros((20,20))
p.ion()
ax=p.imshow(image)
p.draw()

for i in range(10):
print i
p.ion()
image[i,:]=i
ax.set_array(image)
p.draw()

But the image is not updated at all…
what am I doing wrong?

I have the 0.99.1.1 version of matplotlib.

Cheers,
Chiara

···

Hotmail: Powerful Free email with security by Microsoft. Get it now.

set_array method only update the underlying array, and no more.
The problem is that, the first imshow results in clim=(0,0) and
set_array does not change this.
You may manually update the clim of the image, or you may explicitly
call autoscale() after set_array.

Regards,

-JJ

···

On Fri, May 21, 2010 at 1:56 PM, Chiara Caronna <chiaracaronna@...32...> wrote:

Hi,
I am trying to update the image plotted in a figure. From what I understood,
this code should do the job:

import pylab as p

image=p.zeros((20,20))
p.ion()
ax=p.imshow(image)
p.draw()

for i in range(10):
print i
p.ion()
image[i,:]=i
ax.set_array(image)
p.draw()

But the image is not updated at all....
what am I doing wrong?

I have the 0.99.1.1 version of matplotlib.

Cheers,
Chiara

________________________________
Hotmail: Powerful Free email with security by Microsoft. Get it now.
------------------------------------------------------------------------------

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users