Skip to content

Commit

Permalink
Make strip plot legend horizontal
Browse files Browse the repository at this point in the history
  • Loading branch information
mariya committed Nov 26, 2024
1 parent befa5c9 commit 47b8f6a
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/conformist/prediction_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ def softmax_summary(self):
cellLoc='center',
)

plt.title('Predicted classes', weight='bold')
plt.title('Predicted class', weight='bold')

accent_color = "#d4cbb3"
# Make font color dark gray
Expand Down Expand Up @@ -625,13 +625,16 @@ def visualize_prediction_stripplot(self,
legend_handles = [Patch(color=class_to_color[cls], label=cls) for
cls in class_names]

# Position the legend to the right of the plot with bars instead of dots
legend = plt.legend(handles=legend_handles,
title="Predicted Classes",
bbox_to_anchor=(1.05, 1),
loc='upper left',
borderaxespad=0.)

legend = plt.legend(legend_handles,
class_names,
title="Predicted class",
loc='lower center',
frameon=False,
ncol=4,
bbox_to_anchor=(0.5, -0.2), # Adjust position: (x, y)
handletextpad=1, # Increase padding between legend handle and text
columnspacing=8 # Increase spacing between columns
)
font_properties = FontProperties(weight='bold')
legend.get_title().set_font_properties(font_properties)

Expand Down

0 comments on commit 47b8f6a

Please sign in to comment.