Add separate plot for each temperature
This commit is contained in:
parent
7afb51357e
commit
cd1820b1a4
@ -1,22 +1,43 @@
|
||||
import matplotlib.pyplot as plt
|
||||
import seaborn as sns
|
||||
|
||||
sns.set_theme()
|
||||
params = {
|
||||
"font.family": "Serif",
|
||||
"font.serif": "Roman",
|
||||
"text.usetex": True,
|
||||
"axes.titlesize": "large",
|
||||
"axes.labelsize": "large",
|
||||
"xtick.labelsize": "large",
|
||||
"ytick.labelsize": "large",
|
||||
"legend.fontsize": "medium"
|
||||
}
|
||||
plt.rcParams.update(params)
|
||||
|
||||
def plot_from_file():
|
||||
files = [
|
||||
"output/burn_in_time/unordered_1_0.txt",
|
||||
"output/burn_in_time/ordered_1_0.txt",
|
||||
"output/burn_in_time/unordered_2_4.txt",
|
||||
"output/burn_in_time/ordered_2_4.txt",
|
||||
# "output/burn_in_time/unordered_1_0_1421110368.txt",
|
||||
# "output/burn_in_time/ordered_1_0_611577739.txt",
|
||||
"output/burn_in_time/unordered_2_4_1212892317.txt",
|
||||
"output/burn_in_time/ordered_2_4_2408603856.txt",
|
||||
]
|
||||
labels = [
|
||||
"1.0, unordered",
|
||||
"1.0, ordered",
|
||||
"2.4, unordered",
|
||||
"2.4, ordered"
|
||||
"Unordered",
|
||||
"Ordered",
|
||||
# "2.4, unordered",
|
||||
# "2.4, ordered"
|
||||
]
|
||||
colors = [
|
||||
"seagreen",
|
||||
"darkred",
|
||||
# "darkgoldenrod",
|
||||
# "steelblue"
|
||||
]
|
||||
figure1, ax1 = plt.subplots()
|
||||
figure2, ax2 = plt.subplots()
|
||||
|
||||
for infile, label in zip(files, labels):
|
||||
fig1, ax1 = plt.subplots()
|
||||
fig2, ax2 = plt.subplots()
|
||||
|
||||
for infile, label, color in zip(files, labels, colors):
|
||||
with open(infile) as f:
|
||||
lines = f.readlines()
|
||||
|
||||
@ -29,13 +50,17 @@ def plot_from_file():
|
||||
energy.append(float(items[1]))
|
||||
magnetization.append(float(items[5]))
|
||||
|
||||
ax1.plot(t, energy, label=fr"$\langle \epsilon \rangle$ {label}")
|
||||
ax2.plot(t, magnetization, label=fr"$\langle | m | \rangle$ {label}")
|
||||
ax1.plot(t, energy, label=f"{label}", color=color)
|
||||
ax2.plot(t, magnetization, label=f"{label}", color=color)
|
||||
|
||||
figure1.legend()
|
||||
figure1.savefig("../latex/images/burn_in_time_energy.pdf")
|
||||
figure2.legend()
|
||||
figure2.savefig("../latex/images/burn_in_time_magnetization.pdf")
|
||||
ax1.set_xlabel("t")
|
||||
ax1.set_ylabel(r"$\langle \epsilon \rangle$")
|
||||
ax1.legend(title="Initial state")
|
||||
fig1.savefig("../latex/images/burn_in_time_energy_2_4.pdf", bbox_inches="tight")
|
||||
ax2.set_ylabel(r"$\langle |m| \rangle$")
|
||||
ax2.set_xlabel("t")
|
||||
ax2.legend(title="Initial state")
|
||||
fig2.savefig("../latex/images/burn_in_time_magnetization_2_4.pdf", bbox_inches="tight")
|
||||
|
||||
def main():
|
||||
plot_from_file()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user