Reputation: 3509
I have file which contains a list of coordinates. I would like to take each point and plot it one after another, creating some sort of animation.
Assuming I am getting the data like this, what should I do in order to have each point plotted for a split second and then replaced with the next one?
...
for line in f:
data = line.split(',')
x_coord = data[0]
y_coord = data[1]
...
Upvotes: 1
Views: 144
Reputation: 8492
Plotting one by one isn't the answer - you're unlikely to be able to control the speed at which each plot
call pops up on the screen, as that may be window-manager dependent and won't create a good user experience.
If you don't need a live animation, you could render each plot as a PNG, then use mencoder to generate the animation, as described in the Matplotlib FAQ.
If you do want a live animation, that's what matplotlib's animation is for. Steinar Lima links to a good Stack Overflow answer above.
Upvotes: 1