Hi to all,
I'm doing a simple animation like this:
···
--
ion()
x = arange(0,2,0.01)
y = zeros_like(x)
y[45:55]=1
l, = plot(x,y)
D = 0.1
h = x[1]-x[0]
dt = 0.0001;
def nabla(v,h):
na = zeros_like(v)
na[1:-1] = (v[2:]-2*v[1:-1]+v[:-2])
na[0],na[-1] = 0,0
return na/(h**2)
for i in range(1000):
y = y + D*nabla(y,h)*dt
if i%10 == 0:
l.set_ydata(y)
draw()
--
however, changing the line
y = y + D*nabla(y,h)*dt with
in
y += D*nabla(y,h)*dt
the plot is not updated anymore. I have to replace l.set_ydata(y) with
y.recache() to make the the animation work again.
I think this is a bug since the line should be updated even using the
+= operator.
Regards,
Antonio