Python Forum
Animated scatter plot - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Animated scatter plot (/thread-32062.html)



Animated scatter plot - maximan - Jan-18-2021

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