-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplot_tvd.py
More file actions
46 lines (35 loc) · 988 Bytes
/
Copy pathplot_tvd.py
File metadata and controls
46 lines (35 loc) · 988 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import matplotlib.pyplot as plt
import pandas as pd
# PRE PROCESSING
cols = ["d1", "d2", "T", "terms", "tvd", "speedup"]
opt = pd.read_csv("./scripts/optimal.csv", engine="python")
opt.columns = cols
opt = opt.astype(float)
opt["trunc"] = 1e-6
opt["d1"] = opt["d1"].astype(int)
opt["d2"] = opt["d2"].astype(int)
# MAIN
df = opt.copy()
fig, ax = plt.subplots(figsize=(8, 5))
tvd = df["tvd"].clip(lower=0)
sizes = 100 * (tvd / tvd.max()) + 10
sc = ax.scatter(
df["d1"],
df["d2"],
s=sizes,
c=tvd,
cmap="viridis",
alpha=0.8,
edgecolors="k",
linewidths=0.6,
)
ax.set_xlabel("$d_1$", fontsize=14)
ax.set_ylabel("$d_2$", fontsize=14)
ax.set_xticks(sorted(df["d1"].unique()))
ax.set_yticks(sorted(df["d2"].unique()))
ax.tick_params(axis="both", which="both", labelsize=14)
ax.grid(True, which="both", linestyle="--", alpha=0.4)
cbar = plt.colorbar(sc, ax=ax)
cbar.set_label("TVD", fontsize=12)
plt.tight_layout()
plt.savefig("./local/tvd.png", dpi=300)