def leaderboard(benchmark, results=None, output_dir=None, leaderboard_dir=
    None, **ax_set_kwargs):
    """Generates a leaderboard for all metrics in `benchmark`,
  by appending the (optional) `results`.
  
  Args:
    benchmark: `str`, the registerd name of `bdlb.Benchmark`.
    results: (optional) `dict`, dictionary of `pandas.DataFrames`
      with the results from a new method to be plotted against
      the leaderboard.
    leaderboard_dir: (optional) `str`, the path to the parent
      directory with all the leaderboard results.
    output_dir: (optional) `str`, the directory name to
      store the figures.
  """
    import os
    import pandas as pd
    import matplotlib.pyplot as plt
    from .constants import BDLB_ROOT_DIR
    COLORS = plt.rcParams['axes.prop_cycle'].by_key()['color']
    MARKERS = ['o', 'D', 's', '8', '^', '*']
    leaderboard_dir = leaderboard_dir or os.path.join(BDLB_ROOT_DIR,
        'leaderboard')
    benchmark_dir = os.path.join(leaderboard_dir, benchmark)
    if not os.path.exists(benchmark_dir):
        ValueError('No leaderboard data found at {}'.format(benchmark_dir))
    metrics = os.listdir(benchmark_dir)
    for metric in metrics:
        fig, ax = plt.subplots()
        baselines = os.listdir(os.path.join(benchmark_dir, metric))
        for b, baseline in enumerate(baselines):
            baseline = baseline.replace('.csv', '')
            df = pd.read_csv(os.path.join(benchmark_dir, metric, '{}.csv'.
                format(baseline)))
            retained_data = df['retained_data']
            mean = df['mean']
            std = df['std']
            ax.plot(retained_data, mean, label=baseline, color=COLORS[b %
                len(COLORS)], marker=MARKERS[b % len(MARKERS)])
            ax.fill_between(retained_data, mean - std, mean + std, color=
                COLORS[b % len(COLORS)], alpha=0.25)
        if results is not None:
            if metric in results:
                df = results[metric]
                baseline = df.name if hasattr(df, 'name') else 'new_method'
                retained_data = df['retained_data']
                mean = df['mean']
                std = df['std']
                ax.plot(retained_data, mean, label=baseline, color=COLORS[(
                    b + 1) % len(COLORS)], marker=MARKERS[(b + 1) % len(
                    MARKERS)])
                ax.fill_between(retained_data, mean - std, mean + std,
                    color=COLORS[(b + 1) % len(COLORS)], alpha=0.25)
        ax.set(xlabel='retained data', ylabel=metric)
        ax.legend()
        fig.tight_layout()
        if isinstance(output_dir, str):
            os.makedirs(output_dir, exist_ok=True)
            fig.savefig(os.path.join(output_dir, '{}.pdf'.format(metric)),
                trasparent=True, dpi=300, format='pdf')
        fig.show()
