|
3 | 3 | # For the full copyright and license information, please view the LICENSE |
4 | 4 | # file that was distributed with this source code. |
5 | 5 |
|
6 | | -from datetime import datetime |
7 | | -from email.utils import parsedate |
8 | | - |
9 | 6 | import sys |
10 | | -import time |
11 | 7 |
|
12 | 8 | import matplotlib.pyplot as plt |
13 | 9 | import pandas as pd |
14 | 10 |
|
15 | 11 | if len(sys.argv) <= 2: |
16 | | - print('graph.py: <json file> <title>') |
| 12 | + print("graph.py: <json file> <title>") |
17 | 13 | sys.exit() |
18 | 14 |
|
19 | 15 | d = pd.read_json(sys.argv[1], orient="index") |
|
22 | 18 |
|
23 | 19 | df.columns.names = ["date"] |
24 | 20 |
|
25 | | -as_list = df.index.tolist() |
26 | | -for i in as_list: |
27 | | - idx = as_list.index(i) |
28 | | - t = parsedate(i) |
29 | | - as_list[idx] = datetime.fromtimestamp(time.mktime(t)) |
30 | | - |
31 | | -df.index = as_list |
| 21 | +df.index = pd.to_datetime(df.index, utc=True) |
32 | 22 |
|
33 | 23 | print(df) |
34 | 24 |
|
35 | | -ax = plt.gca() |
| 25 | +fig, ax = plt.subplots(figsize=(9.6, 7.2)) |
36 | 26 | df.plot(y="total", color="blue", ax=ax) |
37 | 27 | df.plot(y="fail", color="gray", ax=ax, dashes=(2, 1)) |
38 | 28 | df.plot(y="pass", color="green", ax=ax, dashes=(4, 1)) |
39 | 29 | if "error" in df: |
40 | 30 | df.plot(y="error", color="orange", ax=ax, dashes=(6, 2)) |
41 | 31 | df.plot(y="skip", color="violet", ax=ax, dashes=(8, 3)) |
42 | | -plt.title("Rust/Coreutils running {}'s testsuite".format(title)) |
43 | | -plt.xticks(rotation=45) |
| 32 | +plt.title(f"Rust/Coreutils running {title}'s testsuite") |
| 33 | +fig.autofmt_xdate() |
| 34 | +plt.margins(0.01) |
44 | 35 | plt.ylim(ymin=0) |
45 | | -plt.savefig("{}-results.png".format(title), dpi=199) |
| 36 | +plt.savefig(f"{title.lower()}-results.svg", format="svg", dpi=199, bbox_inches="tight") |
0 commit comments