13import matplotlib.pyplot
as plt
19 "font.family":
"Serif",
20 "font.serif":
"Roman",
22 "axes.titlesize":
"large",
23 "axes.labelsize":
"large",
24 "xtick.labelsize":
"large",
25 "ytick.labelsize":
"large",
26 "legend.fontsize":
"medium",
28plt.rcParams.update(params)
33 "output/simulate_2_particles/no_interaction/",
34 "output/simulate_2_particles/with_interaction/",
40 labels = [
r"$p_1$",
r"$p_2$"]
42 "../latex/images/phase_space_no_interaction",
43 "../latex/images/phase_space_interaction",
50 for i, dir
in enumerate(directories):
51 fig1, axs1 = plt.subplots(sharex=
True)
52 fig2, axs2 = plt.subplots(sharex=
True)
53 for j, (file, label, color)
in enumerate(zip(files, labels, colors)):
56 with open(dir + file +
"_r.txt")
as f:
59 [list(map(float, line.strip().split(
",")))
for line
in lines]
62 with open(dir + file +
"_v.txt")
as f:
65 [list(map(float, line.strip().split(
",")))
for line
in lines]
67 axs1.plot(r[:, 0], v[:, 0], label=label, color=color)
68 axs1.plot(r[0,0], v[0,0],
"ko")
69 axs2.plot(r[:, 2], v[:, 2], label=label, color=color)
70 axs2.plot(r[0,2], v[0,2],
"ko")
74 axs1.set(xlabel=
r"$x (\mu m)$", ylabel=
r"$v_x (\mu m / \mu s)$")
75 axs2.set(xlabel=
r"$z (\mu m)$", ylabel=
r"$v_z (\mu m / \mu s)$")
77 axs1.legend(loc=
"upper right")
78 axs2.legend(loc=
"upper right")
80 fig1.savefig(f
"{output[i]}_x.pdf", bbox_inches=
"tight")
81 fig2.savefig(f
"{output[i]}_z.pdf", bbox_inches=
"tight")
85if __name__ ==
"__main__":