Skip to content

Commit 6e8fe8c

Browse files
author
Harry Li
committed
tweaked stacked bar chart
1 parent d5ed9ab commit 6e8fe8c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,11 @@ def correctness_stacked_barchart():
126126
x = np.arange(len(question_types)) # X-axis positions for question_types
127127
algorithms = ['LinkQ', 'GPT-4'] # this list determines left to right ordering of the algorithms
128128
correctness = ['3/3','2/3','1/3'] # this list determines bottom to top stacking order of correctness
129-
width = 0.35 # Width of the bar
129+
width = 0.38 # Width of the bar
130130

131131
# Plot side-by-side stacked bars
132132
fig, ax = plt.subplots()
133+
fig.set_figwidth(7)
133134
for alg_idx, algorithm in enumerate(algorithms):
134135
# Filter data for the current algorithm
135136
algorithm_data = df[df['Algorithm'] == algorithm]
@@ -162,14 +163,15 @@ def correctness_stacked_barchart():
162163

163164
# Label the percentage sums
164165
for xpos, total in zip(plot_x, bottom):
165-
ax.text(x=xpos, y=total + 0.5, s=percent_formatter(total), ha='center', va='bottom', fontsize=10)
166+
ax.text(x=xpos, y=total + 0.5, s=percent_formatter(total), ha='center', va='bottom', fontsize=11)
166167

167168
ax.set_xlabel('Question Type')
168169
ax.set_ylabel('% Correct')
169170
# ax.set_title('Side-by-Side Stacked Bar Chart')
170171
ax.set_xticks(x)
171172
ax.set_xticklabels(question_types)
172173
ax.legend(title="# Correct / 3 Attempts", title_fontsize=10, bbox_to_anchor=(1, 1), loc='upper left')
174+
plt.grid(axis='x', which='both', visible=False)
173175
plt.tight_layout()
174176
plt.savefig(Path(PLOTS, 'correctness_stacked.pdf'), bbox_inches='tight', format='pdf')
175177
plt.close()

0 commit comments

Comments
 (0)