-
Notifications
You must be signed in to change notification settings - Fork 0
/
plot.py
31 lines (23 loc) · 946 Bytes
/
plot.py
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
from collections import defaultdict
import csv
import matplotlib.pyplot as plt
import pandas as pd
import seaborn as sns
if __name__ == "__main__":
examples = defaultdict(list)
with open("dist/report.csv") as f:
reader = csv.DictReader(f)
for row in reader:
row['milliseconds'] = float(row['nanoseconds']) / 1e6
examples[row["name"]].append(row)
for (name, data) in examples.items():
data = pd.DataFrame(data)
plt.figure(figsize=(6, 6), dpi=96)
# Mark with gray if the command failed
colors = ['green' if s == '0' else 'gray' for s in data.exit_status]
plot = sns.barplot(data, x="implementation", y="milliseconds", palette=colors, errorbar=None)
plot.set(xlabel=None)
plot.tick_params(axis='x', rotation=30)
plt.tight_layout()
plot.get_figure().savefig(f"dist/results/plots/{name}.png", dpi=96)
plt.clf()