Skip to content

Instantly share code, notes, and snippets.

@jhjensen2
Last active November 19, 2019 16:54
Show Gist options
  • Save jhjensen2/13fa53b849965c93efebed2849f9bf69 to your computer and use it in GitHub Desktop.
Save jhjensen2/13fa53b849965c93efebed2849f9bf69 to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
from IPython.display import clear_output
import time
n_particles = 100
for x in range(50):
clear_output(wait=True)
positions_x = [np.random.random() for i in range(n_particles)]
positions_y = [2*(np.random.random()-0.5) for i in range(n_particles)]
plt.plot(positions_x , positions_y,'ro')
plt.axis((-1.0 , 1.0 , -1.0 , 1.0))
plt.show()
time.sleep(0.01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment