Hi, 

Just upadated to 4.0 & trying to run the following code..

import numpy as np
import math as mt
import random
from matplotlib import pyplot as plt
from matplotlib import animation

x = y = 0
labx = [0]
laby = [0]

n = 100 #int(input("number of moves "))

for i in range(0,n):
    x = x + np.cos(float(random.randint(0,360)) * (180 / (mt.pi)))
    y = y + np.sin(float(random.randint(0,360)) * (180 / (mt.pi)))
    labx.append(x)
    laby.append(y)

fig = plt.figure()
line, = plt.plot(labx, laby, "o-", lw = 2)

def init():
    line.set_data([], [])
    return line,


def animate(n):
    line.set_data(labx[:n+1], laby[:n+1])
    return line,

anim = animation.FuncAnimation(fig, animate, init_func = init, frames=200, 
interval=20, blit=True)

plt.show()

But I just get an empty plot with no animation. 

The animation can be seen by using...

%matplotlib auto
%matpltlib qt

Is there no way of seeing it the plot plane?


-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/spyderlib/47ecf7be-7bb5-4c64-b090-2d2bf51ce704%40googlegroups.com.

Reply via email to