Hello, I'm new in matplotlib, but I have became a fat! First of all, I have to apologize for my bad English, I hope you can understand what I mean. Making some programs I have found the same problem: > -What I want? I want to plot two sets of changing data using the same > windows. > -The problem? My code is: > ----------------------- > x,y = evol.plot_init() > pylab.ion() > pylab.subplot(211) > line,=pylab.plot(x[0],x[1]) > pylab.draw() > pylab.ylabel('Posiciones') > for k in pylab.arange(Nt): > x, y = evol.plot_step() > line.set_ydata(x[1]) > pylab.draw() > > > pylab.subplot(212) > line,=pylab.plot(y[0],y[1]) > pylab.draw() > pylab.ylabel('Momentos') > > for k in pylab.arange(Nt): > x, y = evol.plot_step() > line.set_ydata(y[1]) > pylab.draw() > --------------------------------------------------------------------- > And if you run this, one draw and anim is done first, you have to wait > it to stop, and then you can see the other want. > The thing is that I want that the two anim figures runs at the same time. > > Any idea? >
Hello darkside, I set up a little program hoping it offers a solution to your problem. Matthias >------------------------------------------------------------------------------- from numpy.random import uniform import pylab Nt = 20 x,y = uniform(size=(100,Nt+1)),uniform(size=(100,Nt+1)) pylab.ion() ax1 = pylab.subplot(211) pylab.ylabel('Posiciones') ax2 = pylab.subplot(212) pylab.ylabel('Momentos') line1,= ax1.plot(x[:,0], x[:,1]) line2,= ax2.plot(y[:,0], y[:,1]) pylab.draw() pylab.draw() # alternative you could use """ pylab.axes(ax1) line1,= pylab.plot(x[:,0], x[:,1]) pylab.axes(ax2) line2,= pylab.plot(y[:,0], y[:,1]) pylab.draw() """ for k in pylab.arange(Nt): line1.set_ydata(x[:,k+1]) line2.set_ydata(y[:,k+1]) pylab.draw() pylab.draw() pylab.ioff() pylab.show() >-------------------------------------------------------------------