Python Forum

Full Version: Animated scatter plot
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I try to get a animated scatter plot, in which a y value is plotted for every x, each second.

x = np.array(range(0,750))
y = np.array(np.random.rand(750))
for i in range(0,len(x)):
plt.scatter(x[i],y[i])
plt.axis([0,750,0,1])
plt.xlabel('x')
plt.ylabel('y')
plt.draw()
plt.pause(interval=0.1)


The axis should remain constant and previous plotted dots should hold. Can anyone help me with the standard form?
I've tried with matplotlib.animation, but I can't make it work. Right now it plots a new figure for every i