示例#1
0
    return s + "/"


def prepare_data(data, xn, yn):
    """Change format from (algo, instance, dict) to (algo, instance, x, y)."""
    res = []
    for algo, algo_name, result in data:
        res.append((algo, algo_name, result[xn], result[yn]))
    return res


parser = argparse.ArgumentParser()
parser.add_argument('--plottype',
                    help='Generate only the plots specified',
                    nargs='*',
                    choices=plot_variants.keys(),
                    default=plot_variants.keys())
parser.add_argument('--outputdir',
                    help='Select output directory',
                    default='.',
                    type=directory_path,
                    action='store')
parser.add_argument('--latex',
                    help='generates latex code for each plot',
                    action='store_true')
parser.add_argument('--scatter',
                    help='create scatterplot for data',
                    action='store_true')
parser.add_argument('--recompute',
                    help='Clears the cache and recomputes the metrics',
                    action='store_true')
        algostyle = ls[algo]
        new_ls[algo] = (convert_color(algostyle[0]), convert_color(algostyle[1]),
                algostyle[2], point_styles[algostyle[3]])
    return new_ls

def directory_path(s):
    if not os.path.isdir(s):
        raise argparse.ArgumentTypeError("'%s' is not a directory" % s)
    return s + "/"

parser = argparse.ArgumentParser()
parser.add_argument(
    '--plottype',
    help = 'Generate only the plots specified',
    nargs = '*',
    choices = plot_variants.keys(),
    default = plot_variants.keys())
parser.add_argument(
    '--outputdir',
    help = 'Select output directory',
    default = '.',
    type=directory_path,
    action = 'store')
parser.add_argument(
    '--definitions',
    help = 'YAML file with dataset and algorithm annotations',
    action = 'store')
parser.add_argument(
    '--limit',
    help='the maximum number of points to load from the dataset, or -1 to load all of them',
    type=int,