From cbe3f410edceb88bcbc4d03a0d49dc6d2fe25d28 Mon Sep 17 00:00:00 2001 From: Alex Moreo Date: Fri, 20 May 2022 11:52:59 +0200 Subject: [PATCH] updating diagonal plot legend --- quapy/plot.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/quapy/plot.py b/quapy/plot.py index cdb9b1e..cafe520 100644 --- a/quapy/plot.py +++ b/quapy/plot.py @@ -7,9 +7,9 @@ from scipy.stats import ttest_ind_from_stats import quapy as qp -plt.rcParams['figure.figsize'] = [12, 8] +plt.rcParams['figure.figsize'] = [10, 6] plt.rcParams['figure.dpi'] = 200 -plt.rcParams['font.size'] = 16 +plt.rcParams['font.size'] = 18 def binary_diagonal(method_names, true_prevs, estim_prevs, pos_class=1, title=None, show_std=True, legend=True, @@ -49,9 +49,9 @@ def binary_diagonal(method_names, true_prevs, estim_prevs, pos_class=1, title=No table = {method_name:[true_prev, estim_prev] for method_name, true_prev, estim_prev in order} order = [(method_name, *table[method_name]) for method_name in method_order] - cm = plt.get_cmap('tab20') - NUM_COLORS = len(method_names) - ax.set_prop_cycle(color=[cm(1. * i / NUM_COLORS) for i in range(NUM_COLORS)]) + #cm = plt.get_cmap('tab20') + #NUM_COLORS = len(method_names) + #ax.set_prop_cycle(color=[cm(1. * i / NUM_COLORS) for i in range(NUM_COLORS)]) for method, true_prev, estim_prev in order: true_prev = true_prev[:,pos_class] estim_prev = estim_prev[:,pos_class] @@ -76,11 +76,11 @@ def binary_diagonal(method_names, true_prevs, estim_prevs, pos_class=1, title=No if legend: # box = ax.get_position() # ax.set_position([box.x0, box.y0, box.width * 0.8, box.height]) - # ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) + ax.legend(loc='center left', bbox_to_anchor=(1, 0.5)) # ax.set_position([box.x0, box.y0, box.width * 0.8, box.height]) - ax.legend(loc='lower center', - bbox_to_anchor=(1, -0.5), - ncol=(len(method_names)+1)//2) + #ax.legend(loc='lower center', + # bbox_to_anchor=(1, -0.5), + # ncol=(len(method_names)+1)//2) _save_or_show(savepath)