Re: [Matplotlib-users] animations with subplot From: Matthias Michler - 2007-03-01 09:43 ```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() >------------------------------------------------------------------- ```
 Re: [Matplotlib-users] animations with subplot From: Matthias Michler - 2007-03-01 09:43 ```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() >------------------------------------------------------------------- ```