Hi all,

I'm trying to do a plot which is dynamically updated.

However, the axis limits remain fixed even when the data goes out of the 
current ylim. Is there an easy way to keep the axis limits updated when 
the data gets updated?

I've trivially modified the anim.py example to show the problem. The 
sinusoid test data is updated with varying sinusoidal amplitude.

Using matplotlib 0.91.2

Thanks,
Venkat.

import pylab as p
import time
p.ion()

tstart = time.time()                 # for profiling
x = p.arange(0, 2*p.pi, 0.01)        # x-array
i=0
nframes=100
A=2*p.sin(2*p.pi*(1/float(2*nframes))*i)
sindata=A*p.sin(x+i/10.0)
line, = p.plot(x, sindata)
ax=p.gca()
#ax.set_ylim(-2,2)
p.draw()
for i in p.arange(1,nframes):
    A=2*p.sin(2*p.pi*(1/float(2*nframes))*i)
    sindata=A*p.sin(x)
    line.set_ydata(sindata)  # update the data
    p.draw()                         # redraw the canvas

print 'FPS:' , nframes/(time.time()-tstart)

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to