Hi,
I am having some difficulties understanding the following matplotlib
behavior.
The script below draws two plots and then updates each one with new
data. The
imshow() command is used to set the initial data. The data is then
updated with
the set_data() method of the return object from imshow(). The second
plot
works fine, however, the first plot does not update itself after the
set_data() command
and subsequent draw() command. I am baffled as to the reason for this
and was wondering
what the correct behavior should be.
I am using matplotlib version '0.87.7', numpy version '1.0' and
python version '2.4.2'.
Cheers
The script.
import pylab, numpy
pylab.ion()
## make figure 0, works fine
fig0 = pylab.figure()
pylab.title('data0')
image0 = pylab.imshow(numpy.zeros((2,2), 'd'))
pylab.colorbar()
pylab.draw()
raw_input('fig 0')
## make figure 1, works fine
fig1 = pylab.figure()
pylab.title('data1')
image1 = pylab.imshow(numpy.zeros((2,2), 'd'))
pylab.colorbar()
pylab.draw()
raw_input('fig 1')
## redraw figure 0 with new data, this figure does not update itself
newdata = numpy.array(((0.,1.),(2.,3.)))
pylab.figure(fig0.number)
image0.set_data(newdata)
pylab.clim(vmax=3, vmin=0)
pylab.draw()
raw_input('fig 0')
## redraw figure 1 with new data, works fine
pylab.figure(fig1.number)
image1.set_data(newdata)
pylab.clim(vmax=3, vmin=0)
pylab.draw()
raw_input('fig 1')
--
Daniel Wheeler
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Matplotlib-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-users