def plot_trends()

in pycls/sweep/plotting.py [0:0]


def plot_trends(sweeps, names, metrics, filters, max_cols=0):
    """Plots metric versus sweep for each metric."""
    n_metrics, xs = len(metrics), range(len(sweeps))
    max_cols = max_cols if max_cols else len(sweeps)
    m = int(np.ceil(n_metrics / max_cols))
    n = min(max_cols, int(np.ceil(n_metrics / m)))
    fig, axes = fig_make(m, n, True, sharex=False, sharey=False)
    [ax.axis("off") for ax in axes[n_metrics::]]
    for ax, metric in zip(axes, metrics):
        # Get values to plot
        vals = [get_vals(sweep, metric) for sweep in sweeps]
        vs_min, vs_max = [min(v) for v in vals], [max(v) for v in vals]
        fs_min, fs_med, fs_max = zip(*[f[metric] for f in filters])
        # Show full range
        ax.plot(xs, vs_min, "-", xs, vs_max, "-", c="0.7")
        ax.fill_between(xs, vs_min, vs_max, alpha=0.05, color=_COLOR_FILL)
        # Show good range
        ax.plot(xs, fs_min, "-", xs, fs_max, "-", c="0.5")
        ax.fill_between(xs, fs_min, fs_max, alpha=0.10, color=_COLOR_FILL)
        # Show best range
        ax.plot(xs, fs_med, "-o", c="k")
        # Show good range with markers
        ax.scatter(xs, fs_min, c=get_color(xs), marker="^", s=80, zorder=10)
        ax.scatter(xs, fs_max, c=get_color(xs), marker="v", s=80, zorder=10)
        # Finalize axis
        ax.set_ylabel(get_info(metric)[1])
        ax.set_xticks([])
        ax.set_xlabel("sweep")
    fig_legend(fig, n, names, markers="D")
    return fig