Loading...
Searching...
No Matches
plot_2_particles.py
import matplotlib.pyplot as plt
import numpy as np
def main():
files = [
"output/simulate_2_particles/no_interaction/particle_0_r.txt",
"output/simulate_2_particles/no_interaction/particle_1_r.txt",
"output/simulate_2_particles/with_interaction/particle_0_r.txt",
"output/simulate_2_particles/with_interaction/particle_1_r.txt"
]
labels = [
"particle 1 no interaction",
"particle 2 no interaction",
"particle 1 with interaction",
"particle 2 with interaction",
]
colors = [
"lightskyblue",
"lightskyblue",
"salmon",
"salmon"
]
for label, color, file in zip(labels, colors, files):
with open(file) as f:
lines = f.readlines()
t = np.linspace(0, 50, len(lines))
r = np.array([list(map(float, line.strip().split(","))) for line in lines])
plt.plot(r[:,0], r[:,1], label=label, color=color)
plt.xlabel(r"x $(\mu m)$")
plt.ylabel(r"y $(\mu m)$")
plt.title(r"2 particles with and without interactions.")
# plt.legend()
# plt.show()
plt.savefig("../latex/images/plot_2_particles_xy.pdf")
if __name__ == "__main__":
main()