Skip to content
Snippets Groups Projects
Commit 1ae28865 authored by Laura Christine Kühle's avatar Laura Christine Kühle
Browse files

Improved legend layout for model evaluation plots.

parent c4702196
No related branches found
No related tags found
No related merge requests found
......@@ -279,7 +279,7 @@ def plot_classification_accuracy(evaluation_dict: dict, colors: dict) -> None:
pos = np.arange(len(model_names))
width = 1/(3*len(model_names))
fig = plt.figure('classification_accuracy')
ax = fig.add_axes([0.15, 0.3, 0.75, 0.6])
ax = fig.add_axes([0.15, 0.3, 0.6, 0.6])
step_len = 1
adjustment = -(len(model_names)//2)*step_len
for measure in evaluation_dict:
......@@ -295,7 +295,8 @@ def plot_classification_accuracy(evaluation_dict: dict, colors: dict) -> None:
ax.set_ylim(bottom=-0.02)
ax.set_ylim(top=1.02)
ax.set_title('Classification Evaluation (Barplot)')
ax.legend(loc='upper right')
ax.legend(loc='center right', bbox_to_anchor=(1.4, 0.75), shadow=True,
ncol=1, fancybox=True, fontsize=8)
def plot_boxplot(evaluation_dict: dict, colors: dict) -> None:
......@@ -314,7 +315,7 @@ def plot_boxplot(evaluation_dict: dict, colors: dict) -> None:
model_names = evaluation_dict[list(colors.keys())[0]].keys()
font_size = 16 - (len(max(model_names, key=len))//3)
fig = plt.figure('boxplot_accuracy')
ax = fig.add_axes([0.15, 0.3, 0.75, 0.6])
ax = fig.add_axes([0.15, 0.3, 0.6, 0.6])
step_len = 1.5
boxplots = []
adjustment = -(len(model_names)//2)*step_len
......@@ -339,4 +340,5 @@ def plot_boxplot(evaluation_dict: dict, colors: dict) -> None:
ax.set_ylabel('Classification (%)')
ax.set_title('Classification Evaluation (Boxplot)')
ax.legend([bp["boxes"][0] for bp in boxplots], evaluation_dict.keys(),
loc='upper right')
loc='center right', bbox_to_anchor=(1.4, 0.75), shadow=True,
ncol=1, fancybox=True, fontsize=8)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment