Added theme and labels back into python scripts

This commit is contained in:
Janita Willumsen
2023-12-04 15:09:37 +01:00
parent 08a6b32adb
commit 90047decb4
32 changed files with 136 additions and 53 deletions

View File

@@ -2,6 +2,20 @@ from os import makedirs
from pathlib import Path
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(indir, outdir):
@@ -13,8 +27,12 @@ def plot(indir, outdir):
"burn_in.txt",
]
labels = [
"Without burn-in time",
"With burn-in time",
"Without",
"With",
]
colors = [
"darkred",
"seagreen",
]
figure1, ax1 = plt.subplots()
@@ -22,7 +40,7 @@ def plot(indir, outdir):
figure3, ax3 = plt.subplots()
figure4, ax4 = plt.subplots()
for file, label in zip(files, labels):
for file, label, color in zip(files, labels, colors):
t = []
e = []
m = []
@@ -39,20 +57,31 @@ def plot(indir, outdir):
CV.append(float(l[3]))
X.append(float(l[4]))
ax1.plot(t, e, label=label)
ax2.plot(t, m, label=label)
ax3.plot(t, CV, label=label)
ax4.plot(t, X, label=label)
ax1.plot(t, e, label=label, color=color)
ax2.plot(t, m, label=label, color=color)
ax3.plot(t, CV, label=label, color=color)
ax4.plot(t, X, label=label, color=color)
figure1.legend()
figure2.legend()
figure3.legend()
figure4.legend()
ax1.set_xlabel(r"T $(J/k_{B})$")
ax1.set_ylabel(r"$\langle \epsilon \rangle$ $(J)$")
ax1.legend(title="Burn-in time", loc="upper right")
figure1.savefig(Path(outdir, "energy.pdf"))
figure2.savefig(Path(outdir, "magnetization.pdf"))
figure3.savefig(Path(outdir, "heat_capacity.pdf"))
figure4.savefig(Path(outdir, "susceptibility.pdf"))
ax2.set_xlabel(r"T $(J/k_{B})$")
ax2.set_ylabel(r"$\langle |m| \rangle$ $(unitless)$")
ax2.legend(title="Burn-in time", loc="upper right")
ax3.set_xlabel(r"T $(J/k_{B})$")
ax3.set_ylabel(r"$C_{V}$ $(k_{B})$")
ax3.legend(title="Burn-in time", loc="upper right")
ax4.set_xlabel(r"T $(J/k_{B})$")
ax4.set_ylabel(r"$\chi$ $(1/J)$")
ax4.legend(title="Burn-in time", loc="upper right")
figure1.savefig(Path(outdir, "energy.pdf"), bbox_inches="tight")
figure2.savefig(Path(outdir, "magnetization.pdf"), bbox_inches="tight")
figure3.savefig(Path(outdir, "heat_capacity.pdf"), bbox_inches="tight")
figure4.savefig(Path(outdir, "susceptibility.pdf"), bbox_inches="tight")
plt.close(figure1)
plt.close(figure2)