Skip to content

Commit 2248580

Browse files
author
Harry Li
committed
updated stacked bar chart visuals
1 parent 6e8fe8c commit 2248580

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/utils/evaluations/mintaka-wikidata/plot/validation_figures.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
PLOTS = Path(ROOT / 'plots')
1717

1818
def percent_formatter(x):
19-
return f'{round(x)}%'
19+
return f'{'{:.1%}'.format(x/100)}'
2020

2121
CORRECTNESS_PALETTE = {"LinkQ 0/3": '#999999', "LinkQ 1/3": '#c8ddec', "LinkQ 2/3": '#72aad0', "LinkQ 3/3": '#1f78b4', "GPT-4 0/3": '#999999', "GPT-4 1/3": '#fff4e5', "GPT-4 2/3": '#ffdeb3', "GPT-4 3/3": '#fdbf6f'}
2222
QUESTION_TYPE_ORDER = ['Comparative', 'Yes/No', 'Generic', 'MultiHop', "Intersection"]
@@ -130,7 +130,7 @@ def correctness_stacked_barchart():
130130

131131
# Plot side-by-side stacked bars
132132
fig, ax = plt.subplots()
133-
fig.set_figwidth(7)
133+
fig.set_figwidth(8)
134134
for alg_idx, algorithm in enumerate(algorithms):
135135
# Filter data for the current algorithm
136136
algorithm_data = df[df['Algorithm'] == algorithm]
@@ -152,6 +152,8 @@ def correctness_stacked_barchart():
152152
width=width,
153153
color=color,
154154
label=f'{algorithm} {correct}',
155+
edgecolor="black",
156+
linewidth=0.5,
155157
bottom=bottom)
156158

157159
# for xpos, value, y in zip(plot_x, values, bottom):
@@ -163,7 +165,7 @@ def correctness_stacked_barchart():
163165

164166
# Label the percentage sums
165167
for xpos, total in zip(plot_x, bottom):
166-
ax.text(x=xpos, y=total + 0.5, s=percent_formatter(total), ha='center', va='bottom', fontsize=11)
168+
ax.text(x=xpos, y=total + 0.5, s=percent_formatter(total), ha='center', va='bottom', fontsize=9)
167169

168170
ax.set_xlabel('Question Type')
169171
ax.set_ylabel('% Correct')

0 commit comments

Comments
 (0)