Skip to content
Snippets Groups Projects
Commit eb69a6b5 authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME
Browse files

Change legend position code to key string

parent c959ed96
No related branches found
No related tags found
1 merge request!61Title and histograms subplots
Pipeline #
......@@ -47,7 +47,7 @@ def metrics(ctx, scores, evaluation, **kwargs):
@common_options.title_option()
@common_options.legends_option()
@common_options.no_legend_option()
@common_options.legend_loc_option(dflt=4)
@common_options.legend_loc_option(dflt='lower-right')
@common_options.sep_dev_eval_option()
@common_options.output_plot_file_option(default_out='roc.pdf')
@common_options.eval_option()
......@@ -92,7 +92,7 @@ def roc(ctx, scores, evaluation, **kwargs):
@common_options.title_option()
@common_options.legends_option()
@common_options.no_legend_option()
@common_options.legend_loc_option(dflt=1)
@common_options.legend_loc_option(dflt='upper-right')
@common_options.sep_dev_eval_option()
@common_options.eval_option()
@common_options.axes_val_option(dflt=[0.01, 95, 0.01, 95])
......@@ -135,7 +135,7 @@ def det(ctx, scores, evaluation, **kwargs):
@common_options.title_option()
@common_options.legends_option()
@common_options.no_legend_option()
@common_options.legend_loc_option(dflt=9)
@common_options.legend_loc_option(dflt='upper-center')
@common_options.points_curve_option()
@common_options.const_layout_option()
@common_options.x_label_option()
......
......@@ -388,15 +388,19 @@ def figsize_option(dflt='4,3', **kwargs):
return custom_figsize_option
def legend_loc_option(dflt=0, **kwargs):
def legend_loc_option(dflt='best', **kwargs):
'''Get the legend location of the plot'''
def custom_legend_loc_option(func):
def callback(ctx, param, value):
ctx.meta['legend_loc'] = value
ctx.meta['legend_loc'] = value.replace('-', ' ')
return value
return click.option(
'-lc', '--legend-loc', default=dflt, show_default=True,
type=INT, help='The legend location code',
type=click.Choice(['best', 'upper-right', 'upper-left',
'lower-left', 'lower-right', 'right',
'center-left', 'center-right', 'lower-center',
'upper-center', 'center']),
help='The legend location code',
callback=callback, **kwargs)(func)
return custom_legend_loc_option
......
......@@ -84,6 +84,7 @@ def test_det():
with runner.isolated_filesystem():
result = runner.invoke(commands.det, ['--split', '--output',
'test.pdf', '--legends', 'A,B',
'-lc', 'upper-right',
dev1, test1, dev2, test2])
if result.output:
click.echo(result.output)
......@@ -112,6 +113,7 @@ def test_epc():
with runner.isolated_filesystem():
result = runner.invoke(commands.epc, ['--output', 'test.pdf',
'--legends', 'A,B',
'-lc', 'upper-right',
dev1, test1, dev2, test2])
if result.output:
click.echo(result.output)
......
......@@ -152,6 +152,7 @@ CLI options
bob.measure.script.common_options.style_option
bob.measure.script.common_options.subplot_option
bob.measure.script.common_options.legend_ncols_option
bob.measure.script.common_options.no_legend_option
Details
-------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment