- #1
Morbidly_Green
- 12
- 0
Homework Statement
I'm plotting moving particles and I need a way to refresh the graph space with every loop. Meaning I want the points to NOT leave a trail of other points behind them . Basically I want to get rid of the old points as I plot new ones.
Homework Equations
N\A
The Attempt at a Solution
The code for plotting that is being used :
Python:
while True:
plt.ion()
plt.show()
x,y = 0,0
for i in range(n_particles):
x = particle_pos[i,0]
y = particle_pos[i,1]
plt.scatter(x,y, color='green')
plt.pause(0.001)
plt.xlim(0 , L)
plt.ylim(0 , L)
Mentor edit - added code tags.
Last edited by a moderator: