Fix programs
This commit is contained in:
@@ -2,7 +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_timing(indir, outdir):
|
||||
if not (path := Path(outdir)).exists():
|
||||
@@ -22,16 +35,19 @@ def plot_timing(indir, outdir):
|
||||
for file, label, xlabel, outfile in zip(files, labels, xlabels, outfiles):
|
||||
figure1, ax1 = plt.subplots()
|
||||
x = []
|
||||
t = []
|
||||
parallel = []
|
||||
serial = []
|
||||
|
||||
with open(Path(indir, file)) as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
l = line.strip().split(",")
|
||||
x.append(float(l[0]))
|
||||
t.append(float(l[1]))
|
||||
parallel.append(float(l[1]))
|
||||
serial.append(float(l[2]))
|
||||
|
||||
ax1.plot(x, t, label=label)
|
||||
ax1.plot(x, parallel, label="Parallel")
|
||||
ax1.plot(x, serial, label="Serial")
|
||||
ax1.set_xlabel(xlabel)
|
||||
ax1.set_ylabel("time (seconds)")
|
||||
|
||||
@@ -44,6 +60,6 @@ def plot_timing(indir, outdir):
|
||||
|
||||
if __name__ == "__main__":
|
||||
plot_timing(
|
||||
"data/hp/timing/",
|
||||
"data/hp/timing",
|
||||
"./latex/images/timing",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user