I have two 2D arrays and I want to display the data in a scatter graph so it will look like the points are moving. So I want the first set of x and y data to be plotted then disappear to be replaced by the next set of x and y data etc.
the code I have currently just plots all the data points and joins them up, effectively tracing out the paths of the data points.
pyplot.figure()
for i in range(0,N):
pyplot.plot(x[i,:],y[i,:],'r-')
pyplot.xlabel('x /m')
pyplot.ylabel('y /m')
pyplot.show()
any help is much appreciated.
The
matplotlib
docs contain some animation examples that may be useful. They all use thematplotlib.animation
API, so I'd suggest you read through that for some ideas. From the examples, here's a simple animated sine curve usingFuncAnimation
: