I'm trying to plot the movement of many particles with periodic boundary conditions. I want to plot their trajectory for the last 10 timesteps.
This is my plot code so far (X is a matrix, each column is a different particle and each row is a different time, that gives me each x coordinate at each time; same goes for Y):
plt.figure()
plt.figure(figsize=(12,11))
plt.grid(True)
plt.plot(X[time_steps-10:],Y[time_steps-10:],'k-')
plt.show()
But I'm having a problem with the plot because, since I'm using lines '-' when the particle leaves one wall and reappears in the other I have a line connecting those two postions that I don't want: