def save(fig, args):
    args.outdir.mkdir(parents=True, exist_ok=True)
    filename = (args.outdir / 'curves.png')
    fig.savefig(filename, dpi=args.dpi)
    print('Saved to', filename)
    filename = (args.outdir / 'curves.pdf')
    fig.savefig(filename)
    try:
        subprocess.call(['pdfcrop', str(filename), str(filename)])
    except FileNotFoundError:
        print('Install texlive-extra-utils to crop PDF outputs.')
def save(fig, args):
    args.outdir.mkdir(parents=True, exist_ok=True)
    filename = (args.outdir / 'curves.png')
    fig.savefig(filename, dpi=args.dpi)
    print('Saved to', filename)
    filename = (args.outdir / 'curves.pdf')
    fig.savefig(filename)
    try:
        subprocess.call(['pdfcrop', str(filename), str(filename)])
    except FileNotFoundError:
        print('Install texlive-extra-utils to crop PDF outputs.')