|
| 1 | +""" |
| 2 | +Renders the ratios from `cts_state.csv` as `resources/cts_state.svg`. |
| 3 | +""" |
| 4 | + |
| 5 | +import os |
| 6 | + |
| 7 | +import pandas as pd |
| 8 | +from matplotlib import pyplot as plt |
| 9 | + |
| 10 | +os.chdir(os.path.join(os.path.dirname(__file__), os.path.pardir)) |
| 11 | + |
| 12 | +state = pd.read_csv('ci/cts_state.csv', delimiter=';') |
| 13 | +counts = state.groupby('status').agg(count=('suite', 'size'))['count'].to_dict() |
| 14 | + |
| 15 | +labels = ['passed', 'run failed', 'build failed', 'not applicable'] |
| 16 | +colors = ['#4a0', '#fa0', '#e44', '#aaa'] |
| 17 | + |
| 18 | +plt.rcParams['svg.fonttype'] = 'none' |
| 19 | + |
| 20 | +fig, ax = plt.subplots(figsize=(8, 0.6)) |
| 21 | +left = 0 |
| 22 | +for l, c in zip(labels, colors): |
| 23 | + n = counts[l] |
| 24 | + ax.barh(0, n, left=left, color=c, label=l) |
| 25 | + ax.text(left + n/2, 0, str(n), ha='center', va='center', weight='bold') |
| 26 | + left += n |
| 27 | +ax.set_xlim(0, left) |
| 28 | +ax.axis('off') |
| 29 | +ax.set_title('SimSYCL spec conformance by number of CTS categories') |
| 30 | + |
| 31 | +fig.legend(loc='lower center', ncols=len(labels), |
| 32 | + bbox_to_anchor=(0, -0.4, 1, 0.5), frameon=False) |
| 33 | +fig.savefig('resources/cts_state.svg', bbox_inches='tight') |
0 commit comments