jiahuimbzuai/CoQuIR huggingface dataset:
//  [python]
def plot_arbitrageur_balances_and_values(ax, df):
    # Plot the balances
    sns.lineplot(x=df.index, y='arbitrageur_relative_balances_x', data=df, label='Relative Arbitrageur Balances X', ax=ax, linewidth=2, alpha=0.5, legend=False)
    sns.lineplot(x=df.index, y='arbitrageur_relative_balances_y', data=df, label='Relative Arbitrageur Balances Y', ax=ax, linewidth=2, alpha=0.5, legend=False)

    # Create a second y-axis to plot the portfolio value
    ax2 = ax.twinx()
    sns.lineplot(x=df.index, y='arbitrageur_portfolio_value', data=df, label='Arbitrageur Portfolio Value', ax=ax2, linewidth=2, color='purple', legend=False)

    # Customize the plot
    ax.set_title('Arbitrageur Balances and Portfolio Values Over Time', fontsize=16)
    ax.set_xlabel('Index', fontsize=14)
    ax.set_ylabel('Balance in WAD', fontsize=14)
    ax.grid(True)

    ax2.set_ylabel('Portfolio Value in WAD', fontsize=14)

    # Combine legends from both axes
    lines, labels = ax.get_legend_handles_labels()
    lines2, labels2 = ax2.get_legend_handles_labels()
    ax2.legend(lines + lines2, labels + labels2, loc=0, fontsize=12)
//  [python]
def __init__(self, data, button: QToolButton, options: dict = None, item_parent=None):
        super(LineChart, self).__init__(button, options, item_parent)

        self.data = pd.read_parquet(data) if isinstance(data, str) else data
        self.data = self.data.iloc[:,0] if self.data.columns.size == 1 else self.data
        # figure canvas definition
        self.set_cw()
        self.fig.set_size_inches(options[('Line Plot', 'figure', 'width')],
                                 options[('Line Plot', 'figure', 'height')])

        self.axes = self.fig.subplots(1, 1)
        if options.get('iec2'):
            self.line_plot_ax = self.axes.plot(self.data['AccIntEnergy'],
                                             color=rgb2rgbf(options[('Line Plot', 'line-color')]),
                                             linewidth=options[('Line Plot', 'line-width')],
                                             label='IE(all)')
            # plot the ie segment
            ie_color = rgb2rgbf(options[('Bar Plot', 'IE/C2 Entropy', 'ie-color')])
            self.axes.plot(self.data['ie'], color=ie_color, label='IE(selected)')
        else:
            self.line_plot_ax = self.axes.plot(self.data, color=rgb2rgbf(options[('Line Plot', 'line-color')]),
                                             linewidth=options[('Line Plot', 'line-width')],
                                             label=self.data.name)
            if options[('Line Plot', 'Rolling average', 'show')]:
                min_periods = 1 if options[('Line Plot', 'Rolling average', 'first_obs')] == 'start' else None
                window = options[('Line Plot', 'Rolling average', 'window')]
                moving_avg = self.axes.plot(self.data.rolling(window, min_periods=min_periods).mean(),
                                          color=rgb2rgbf(options[('Line Plot', 'Rolling average', 'color')]),
                                          linewidth=options[('Line Plot', 'Rolling average', 'width')],
                                          label='Mov. Av.',
                                          ls=options[('Line Plot', 'Rolling average', 'style')])
        self.cursor = Cursor(self.axes, useblit=True, color='black', linewidth=0.5, ls='--')

        self.setWindowTitle(options['subtitle'])
        self.update_config(options)
        self.draw()
//  [python]
def __init__(self, data, button: QToolButton, options: dict = None, item_parent=None):
        super(LineChart, self).__init__(button, options, item_parent)

        self.data = pd.read_parquet(data) if isinstance(data, str) else data
        self.data = self.data.iloc[:,0] if self.data.columns.size == 1 else self.data
        # figure canvas definition
        self.set_cw()
        self.fig.set_size_inches(options[('Line Plot', 'figure', 'width')],
                                 options[('Line Plot', 'figure', 'height')])

        self.axes = self.fig.subplots(1, 1)
        if options.get('iec2'):
            self.line_plot_ax = sns.lineplot(data=self.data['AccIntEnergy'],
                                             color=rgb2rgbf(options[('Line Plot', 'line-color')]),
                                             linewidth=options[('Line Plot', 'line-width')],
                                             ax=self.axes,
                                             label='IE(all)')
            # plot the ie segment
            ie_color = rgb2rgbf(options[('Bar Plot', 'IE/C2 Entropy', 'ie-color')])
            sns.lineplot(data=self.data['ie'], color=ie_color, ax=self.axes, label='IE(selected)')
        else:
            self.line_plot_ax = sns.lineplot(data=self.data, color=rgb2rgbf(options[('Line Plot', 'line-color')]),
                                             linewidth=options[('Line Plot', 'line-width')],
                                             label=self.data.name,
                                             ax=self.axes)
            if options[('Line Plot', 'Rolling average', 'show')]:
                min_periods = 1 if options[('Line Plot', 'Rolling average', 'first_obs')] == 'start' else None
                window = options[('Line Plot', 'Rolling average', 'window')]
                moving_avg = sns.lineplot(data=self.data.rolling(window, min_periods=min_periods).mean(),
                                          color=rgb2rgbf(options[('Line Plot', 'Rolling average', 'color')]),
                                          linewidth=options[('Line Plot', 'Rolling average', 'width')],
                                          label='Mov. Av.',
                                          ls=options[('Line Plot', 'Rolling average', 'style')],
                                          ax=self.axes)
        self.cursor = Cursor(self.axes, useblit=True, color='black', linewidth=0.5, ls='--')

        self.setWindowTitle(options['subtitle'])
        self.update_config(options)
        self.draw()
//  [python]
env.close()
log_df.reset_index(inplace=True, drop=True) 
log_df.to_csv(log_dir + '/reward_log.csv')
#df = pd.read_csv(log_dir + '/reward_log.csv', index_col=False)
print(log_df)
sns.tsplot(x = "episode", y = "reward", data=log_df)
//  [python]
env.close()
log_df.reset_index(inplace=True, drop=True) 
log_df.to_csv(log_dir + '/reward_log.csv')
#df = pd.read_csv(log_dir + '/reward_log.csv', index_col=False)
print(log_df)
sns.lineplot(x = "episode", y = "reward", data=log_df)
//  [python]
def plot(loss1, loss2):
    sns.set(font_scale=1.5)

    data = {
        'epoch': list(range(len(loss1[::num]))) + list(range(len(loss2[::num]))),
        'loss': list(loss1[::num]) + list(loss2[::num]),
        'model': ['Base'] * len(loss1[::num]) + ['CVAE'] * len(loss2[::num]),
    }
    printout = {k: len(v) for k, v in data.items() }
    print('check length:', printout)
    plot = sns.tsplot(data=data, time='epoch', value='loss', unit="model",
                 )
    plot.set(ylim=(0, 0.4), xlabel='Epoch', ylabel="Reconstruction Error",)

    import matplotlib.pyplot as plt
    plt.tight_layout()
    plt.show()
//  [python]
def plot(loss1, loss2):
    sns.set(font_scale=1.5)

    data = {
        'epoch': list(range(len(loss1[::num]))) + list(range(len(loss2[::num]))),
        'loss': list(loss1[::num]) + list(loss2[::num]),
        'model': ['Base'] * len(loss1[::num]) + ['CVAE'] * len(loss2[::num]),
    }
    printout = {k: len(v) for k, v in data.items() }
    print('check length:', printout)
    plot = sns.lineplot(data=data, x='epoch', y='loss', hue="model",
                 )
    plot.set(ylim=(0, 0.4), xlabel='Epoch', ylabel="Reconstruction Error",)

    import matplotlib.pyplot as plt
    plt.tight_layout()
    plt.show()
//  [python]
palette2 = ["mediumpurple", "goldenrod", "midnightblue", "seagreen"]
dashes = [(4,1 ),  (3, 5), (1, 1),(2, 1)]
markers = ["o", "D", "s", "v"]
# languages = ["English", "Dutch", "French", "Spanish"]
plt.figure(figsize=(10,4))
ax = seaborn.pointplot( data=results, palette=palette2, dashes=dashes, markers=markers, linewidth=3, hue_order=["English","Spanish", "Dutch",  "French"] )
//  [python]
palette2 = ["mediumpurple", "goldenrod", "midnightblue", "seagreen"]
dashes = [(4,1 ),  (3, 5), (1, 1),(2, 1)]
markers = ["o", "D", "s", "v"]
# languages = ["English", "Dutch", "French", "Spanish"]
plt.figure(figsize=(10,4))
ax = seaborn.lineplot( data=results, palette=palette2, dashes=dashes, markers=markers, linewidth=3, hue_order=["English","Spanish", "Dutch",  "French"] )
//  [python]
def get_plots(res_root, model, for_supp=None):
    plt.figure(figsize=(30, 15))
    res = get_vanilla_and_finetuned_results(res_root, model)
    ax = sns.pointplot(
        data=pd.melt(res, "experiment"),
        x="experiment", y="value", hue="variable",
        palette=PALETTE, marker="d", markersize=20, linewidth=3,
    )

    ax.set_yticks(np.linspace(0.1, 1, 10)[:-1])

    plt.ylabel("Mean Segmentation Accuracy", labelpad=10, fontweight="bold")
    plt.xlabel("Percent of Data", labelpad=10, fontweight="bold")
    plt.legend(loc="lower center", ncol=6)
    if for_supp is None:
        save_path = "2_c.svg"
    else:
        plt.title(for_supp)
        save_path = f"livecell_supplementary_{model}_reduce_data.svg"

    plt.tight_layout()
    plt.savefig(save_path)
    plt.savefig(Path(save_path).with_suffix(".pdf"))
//  [python]
def get_plots(res_root, model, for_supp=None):
    plt.figure(figsize=(30, 15))
    res = get_vanilla_and_finetuned_results(res_root, model)
    ax = sns.lineplot(
        data=pd.melt(res, "experiment"),
        x="experiment", y="value", hue="variable", marker="d",
        palette=PALETTE, markersize=20, linewidth=3,
    )

    ax.set_yticks(np.linspace(0.1, 1, 10)[:-1])

    plt.ylabel("Mean Segmentation Accuracy", labelpad=10, fontweight="bold")
    plt.xlabel("Percent of Data", labelpad=10, fontweight="bold")
    plt.legend(loc="lower center", ncol=6)
    if for_supp is None:
        save_path = "2_c.svg"
    else:
        plt.title(for_supp)
        save_path = f"livecell_supplementary_{model}_reduce_data.svg"

    plt.tight_layout()
    plt.savefig(save_path)
    plt.savefig(Path(save_path).with_suffix(".pdf"))
//  [python]
def plot_losses_ious(losses_dict, ious_dict, viz_path, prefix='train'):
    """
    Plots and saves.
    """
    title_prefix = str.upper(prefix[0]) + prefix[1:]
    
    loss_epochs = list(losses_dict.keys())
    losses = list(losses_dict[x] for x in loss_epochs)
    iou_epochs = list(ious_dict.keys())
    ious = list(ious_dict[x] for x in iou_epochs)

    loss_path = os.path.join(viz_path, prefix + '_losses.png')
    print(f'Saving losses to {loss_path}...')
    loss_plot = plt.plot(loss_epochs, losses)
    plt.title(title_prefix + ' Loss / Epoch')
    plt.ylabel(title_prefix + ' Loss')
    plt.xlabel('Epoch')
    fig = plt.gcf()
    fig.savefig(loss_path)
    plt.clf()

    iou_path = os.path.join(viz_path, prefix + '_ious.png')
    print(f'Saving ious to {iou_path}...')
    iou_plot = plt.plot(iou_epochs, ious)
    plt.title(title_prefix + ' Iou / Epoch')
    plt.ylabel(title_prefix + ' iou')
    plt.xlabel('Epoch')
    fig = plt.gcf()
    fig.savefig(iou_path)
    plt.clf()
//  [python]
def plot_losses_ious(losses_dict, ious_dict, viz_path, prefix='train'):
    """
    Plots and saves.
    """
    title_prefix = str.upper(prefix[0]) + prefix[1:]
    
    loss_epochs = list(losses_dict.keys())
    losses = list(losses_dict[x] for x in loss_epochs)
    iou_epochs = list(ious_dict.keys())
    ious = list(ious_dict[x] for x in iou_epochs)

    loss_path = os.path.join(viz_path, prefix + '_losses.png')
    print(f'Saving losses to {loss_path}...')
    loss_plot = sns.lineplot(x=loss_epochs, y=losses)
    plt.title(title_prefix + ' Loss / Epoch')
    plt.ylabel(title_prefix + ' Loss')
    plt.xlabel('Epoch')
    fig = loss_plot.get_figure()
    fig.savefig(loss_path)
    plt.clf()

    iou_path = os.path.join(viz_path, prefix + '_ious.png')
    print(f'Saving ious to {iou_path}...')
    iou_plot = sns.lineplot(x=iou_epochs, y=ious)
    plt.title(title_prefix + ' Iou / Epoch')
    plt.ylabel(title_prefix + ' iou')
    plt.xlabel('Epoch')
    fig = iou_plot.get_figure()
    fig.savefig(iou_path)
    plt.clf()
//  [python]
for k in data_csv:
    data = data.append({'Byte':int(k["Byte"]), 'Microseconds': float(k["Nanoseconds"]) / 1000.0}, ignore_index=True)

fig, ax = plt.subplots(1, 1)

ax.set_yscale("log")
ax.set_xscale("log")
sns.pointplot(ax=ax, data=data, x="Byte", y="Microseconds", ci="sd")
//  [python]
for k in data_csv:
    data = data.append({'Byte':int(k["Byte"]), 'Microseconds': float(k["Nanoseconds"]) / 1000.0}, ignore_index=True)

fig, ax = plt.subplots(1, 1)

ax.set_yscale("log")
ax.set_xscale("log")
sns.lineplot(ax=ax, data=data, x="Byte", y="Microseconds", ci="sd")
//  [python]
def plot_divergences(df, title, save_dir = ''):
    '''Plot the peaks and valleys of [close] value against [datetime]
    Args:
        df (pandas.Dataframe): datetime, close, sma180, rsi14, vwap, peak_valley, divergence, profit_proba
        title (str): Chart title
        save_dir (str): Directory to save image e.g. 'D:\\Program Files (x86)\\Stocks', no saving if empty
    '''
    # new columns
    if 'profit_proba' not in df.columns: df['profit_proba'] = -1
    df['period'] = df['Date'] if 'Date' in df.columns else df['datetime'].dt.time.astype('str').str[:5]
    df['close_div'] = np.where(df['divergence']!='', df['close'], np.nan)
    df['close_div_weak'] = np.where((df['divergence']!='')&(df['profit_proba']>0.5), df['close'], np.nan)
    df['close_div_strong'] = np.where((df['divergence']!='')&(df['profit_proba']>0.75), df['close'], np.nan)
    # setup plot
    fig, axs = plt.subplots(nrows=2, ncols=1, figsize=(8,4))
    # top plot - price line plot
    plt.plot(df['period'], df['close'], ax=axs[0])
    plt.plot(df['period'], df['sma180'], color='y', ax=axs[0])
    plt.plot(df['period'], df['vwap'], color='r', ax=axs[0])
    plt.scatter(df['period'], df['close_div'], color='r', ax=axs[0])
    plt.scatter(df['period'], df['close_div_weak'], color='orange', ax=axs[0])
    plt.scatter(df['period'], df['close_div_strong'], color='lime', ax=axs[0])
    # top plot - profit proba labels
    for _, point in df.iterrows():
        x = point['period']
        y = point['close']
        value = point['profit_proba']
        value2 = point['profit']
        div = point['divergence']
        if div and value:
            axs[0].text(x, y*0.992, f'{round(value, 2)}\n({round(value2, 2)})', fontsize=9)
    # bottom plot - rsi14 line plot
    plt.plot(df['period'], df['rsi14'], color='k', ax=axs[1])
    axs[1].axhline(y=30, color='r')
    axs[1].axhline(y=70, color='g')
    # set ticks
    for ax in axs:
        ax.label_outer()
        ax.set_xticks(ax.get_xticks()[::len(ax.get_xticks())//10+1])
        for tick in ax.get_xticklabels():
            tick.set_rotation(45)
    # title
    fig.suptitle(title)
    # save image if directory provided
    if save_dir:
        profit_proba_max = round(df['profit_proba'].max(), 2)
        time_str = datetime.datetime.now().strftime('%H%M')
        plt.savefig(f'{save_dir}\\{sym}_{time_str}_{profit_proba_max}.png', bbox_inches='tight')
    plt.show()
//  [python]
def plot_divergences(df, title, save_dir = ''):
    '''Plot the peaks and valleys of [close] value against [datetime]
    Args:
        df (pandas.Dataframe): datetime, close, sma180, rsi14, vwap, peak_valley, divergence, profit_proba
        title (str): Chart title
        save_dir (str): Directory to save image e.g. 'D:\\Program Files (x86)\\Stocks', no saving if empty
    '''
    # new columns
    if 'profit_proba' not in df.columns: df['profit_proba'] = -1
    df['period'] = df['Date'] if 'Date' in df.columns else df['datetime'].dt.time.astype('str').str[:5]
    df['close_div'] = np.where(df['divergence']!='', df['close'], np.nan)
    df['close_div_weak'] = np.where((df['divergence']!='')&(df['profit_proba']>0.5), df['close'], np.nan)
    df['close_div_strong'] = np.where((df['divergence']!='')&(df['profit_proba']>0.75), df['close'], np.nan)
    # setup plot
    fig, axs = plt.subplots(nrows=2, ncols=1, figsize=(8,4))
    # top plot - price line plot
    sns.lineplot(data=df, x='period', y='close', ax=axs[0])
    sns.lineplot(data=df, x='period', y='sma180', color='y', ax=axs[0])
    sns.lineplot(data=df, x='period', y='vwap', color='r', ax=axs[0])
    sns.scatterplot(data=df, x='period', y='close_div', color='r', ax=axs[0])
    sns.scatterplot(data=df, x='period', y='close_div_weak', color='orange', ax=axs[0])
    sns.scatterplot(data=df, x='period', y='close_div_strong', color='lime', ax=axs[0])
    # top plot - profit proba labels
    for _, point in df.iterrows():
        x = point['period']
        y = point['close']
        value = point['profit_proba']
        value2 = point['profit']
        div = point['divergence']
        if div and value:
            axs[0].text(x, y*0.992, f'{round(value, 2)}\n({round(value2, 2)})', fontsize=9)
    # bottom plot - rsi14 line plot
    sns.lineplot(data=df, x='period', y='rsi14', color='k', ax=axs[1])
    axs[1].axhline(y=30, color='r')
    axs[1].axhline(y=70, color='g')
    # set ticks
    for ax in axs:
        ax.label_outer()
        ax.set_xticks(ax.get_xticks()[::len(ax.get_xticks())//10+1])
        for tick in ax.get_xticklabels():
            tick.set_rotation(45)
    # title
    fig.suptitle(title)
    # save image if directory provided
    if save_dir:
        profit_proba_max = round(df['profit_proba'].max(), 2)
        time_str = datetime.datetime.now().strftime('%H%M')
        plt.savefig(f'{save_dir}\\{sym}_{time_str}_{profit_proba_max}.png', bbox_inches='tight')
    plt.show()
//  [python]
cm_rate_df = process_memorization_over_time(models, checkpoint_names)
_df = cm_rate_df[cm_rate_df['checkpoint'] != '146m']
sns.pointplot(data=_df, x="checkpoint", y="TPR", hue="model")
//  [python]
cm_rate_df = process_memorization_over_time(models, checkpoint_names)
_df = cm_rate_df[cm_rate_df['checkpoint'] != '146m']
sns.lineplot(data=_df, x="checkpoint", y="TPR", hue="model")
//  [python]
def plot_fitted(
        self, 
        models="all", 
        series="all", 
        ax=None,
        figsize=(12,6),
    ):
        """ Plots fitted values with the actuals.

        Args:
            models (list-like or str): Default 'all'.
               The forecasted models to plot.
               Name of the model, 'all', or list-like of model names.
               'top_' and None not supported.
            series (list-like or str): Default 'all'.
               The series to plot.
               Name of the series ('y1...', 'series1...' or user-selected name), 'all', or list-like of series names.
            ax (Axis): Optional. The existing axis to write the resulting figure to.
            figsize (tuple): Default (12,6). Size of the resulting figure. Ignored when ax is not None.


        Returns:
            (Axis): The figure's axis.

        >>> mvf.plot_fitted() # plots all fitted values on all series
        >>> plt.show()
        """
        series = self._parse_series(series)
        models = self._parse_models(models, False)
        if ax is None:
            _, ax = plt.subplots(figsize=figsize)

        k = 0
        for i, s in enumerate(series):
            act = self.y[s].to_list()
            plt.plot(
                self.current_dates.to_list(),
                act[-len(self.current_dates):],
                label=f"{s} actual",
                ax=ax,
                color=__series_colors__[i],
            )
            for m in models:
                fvs = (self.history[m]["FittedVals"][s])
                plt.plot(
                    self.current_dates.to_list()[-len(fvs) :],
                    fvs,
                    label=f"{s} {m}",
                    linestyle="--",
                    alpha=0.7,
                    color=__colors__[k],
                    ax=ax,
                )
                k += 1
//  [python]
def plot_fitted(
        self, 
        models="all", 
        series="all", 
        ax=None,
        figsize=(12,6),
    ):
        """ Plots fitted values with the actuals.

        Args:
            models (list-like or str): Default 'all'.
               The forecasted models to plot.
               Name of the model, 'all', or list-like of model names.
               'top_' and None not supported.
            series (list-like or str): Default 'all'.
               The series to plot.
               Name of the series ('y1...', 'series1...' or user-selected name), 'all', or list-like of series names.
            ax (Axis): Optional. The existing axis to write the resulting figure to.
            figsize (tuple): Default (12,6). Size of the resulting figure. Ignored when ax is not None.


        Returns:
            (Axis): The figure's axis.

        >>> mvf.plot_fitted() # plots all fitted values on all series
        >>> plt.show()
        """
        series = self._parse_series(series)
        models = self._parse_models(models, False)
        if ax is None:
            _, ax = plt.subplots(figsize=figsize)

        k = 0
        for i, s in enumerate(series):
            act = self.y[s].to_list()
            sns.lineplot(
                x=self.current_dates.to_list(),
                y=act[-len(self.current_dates):],
                label=f"{s} actual",
                ax=ax,
                color=__series_colors__[i],
            )
            for m in models:
                fvs = (self.history[m]["FittedVals"][s])
                sns.lineplot(
                    x=self.current_dates.to_list()[-len(fvs) :],
                    y=fvs,
                    label=f"{s} {m}",
                    linestyle="--",
                    alpha=0.7,
                    color=__colors__[k],
                    ax=ax,
                )
                k += 1
//  [python]
def visualize(result, name):
    # (N_samples=5, timesteps=200, types)
    result = np.array(result)
    assert result.shape[2] == 2
    # ax = sns.tsplot(data=result, condition=['OptNet', 'Adam'], linestyle='--')

    def trans(series):
        # (N_samples, timesteps)
        x = np.tile(np.arange(series.shape[1]) + 1,
                    (series.shape[0], 1)).flatten()
        y = series.flatten()
        return {'x': x, 'y': y}
    ax = sns.tsplot(data=result[:, :, 0], condition=['OptNet'], linestyle='--')
    ax = sns.tsplot(data=result[:, :, 1], condition=['Adam'], ax=ax, linestyle='-')
    ax.legend()
    plt.yscale('log'), plt.xlabel('steps')
    plt.ylabel('loss'), plt.title('MNIST')
    plt.ylim(0.09, 3.0)
    plt.xlim(1, result.shape[1])
    plt.grid(which='both', alpha=0.6, color='black', linewidth=0.1,
             linestyle='-')
    ax.tick_params(which='both', direction='in')
    ax.tick_params(which='major', length=8)
    ax.tick_params(which='minor', length=3)
    ax.xaxis.set_minor_locator(AutoMinorLocator(5))

    plt.show()
    plt.savefig(name)
    plt.close()
//  [python]
def visualize(result, name):
    # (N_samples=5, timesteps=200, types)
    result = np.array(result)
    assert result.shape[2] == 2
    # ax = sns.tsplot(data=result, condition=['OptNet', 'Adam'], linestyle='--')

    def trans(series):
        # (N_samples, timesteps)
        x = np.tile(np.arange(series.shape[1]) + 1,
                    (series.shape[0], 1)).flatten()
        y = series.flatten()
        return {'x': x, 'y': y}
    ax = sns.lineplot(label='OptNet', **trans(result[:, :, 0]))
    ax = sns.lineplot(label='Adam', ax=ax, **trans(result[:, :, 1]))
    ax.lines[-1].set_linestyle('-')
    ax.legend()
    plt.yscale('log'), plt.xlabel('steps')
    plt.ylabel('loss'), plt.title('MNIST')
    plt.ylim(0.09, 3.0)
    plt.xlim(1, result.shape[1])
    plt.grid(which='both', alpha=0.6, color='black', linewidth=0.1,
             linestyle='-')
    ax.tick_params(which='both', direction='in')
    ax.tick_params(which='major', length=8)
    ax.tick_params(which='minor', length=3)
    ax.xaxis.set_minor_locator(AutoMinorLocator(5))

    plt.show()
    plt.savefig(name)
    plt.close()
//  [python]
def single_plot(df, ax, variable, lin_trend=False):
    g = sns.tsplot(
        data=df,
        time="n-isolates",
        value=variable,
        unit="length",
        condition="length",
        norm=LogNorm(),
        ci="sd",
        color="Blues_d",
        marker=".",
        ax=ax,
    )
    ax.set_xscale("log")
    ax.set_xlabel("n. isolates")
    ax.grid(alpha=0.2)

    if lin_trend:
        plot_lin_trend(df, "n-isolates", variable, ax)

    g.legend(title="avg. seq. length", fontsize="small", title_fontsize="medium")
//  [python]
def single_plot(df, ax, variable, lin_trend=False):
    g = sns.lineplot(
        data=df,
        x="n-isolates",
        y=variable,
        hue="length",
        hue_norm=LogNorm(),
        ci="sd",
        palette="Blues_d",
        marker=".",
        ax=ax,
    )
    ax.set_xscale("log")
    ax.set_xlabel("n. isolates")
    ax.grid(alpha=0.2)

    if lin_trend:
        plot_lin_trend(df, "n-isolates", variable, ax)

    g.legend(title="avg. seq. length", fontsize="small", title_fontsize="medium")
//  [python]
def plot(
        self, 
        models="all", 
        series="all", 
        put_best_on_top=False, 
        ci=False, 
        ax=None,
        figsize=(12,6),
    ):
        """ Plots all forecasts with the actuals, or just actuals if no forecasts have been evaluated or are selected.

        Args:
            models (list-like or str): Default 'all'.
               The forecasted models to plot.
               Name of the model, 'all', or list-like of model names.
               'top_' and None not supported.
            series (list-like or str): Default 'all'.
               The series to plot.
               Name of the series, 'all', or list-like of series names.
            put_best_on_top (bool): Only set to True if you have previously called set_best_model().
                If False, ignored.
            ci (bool): Default False.
                Whether to display the confidence intervals.
            ax (Axis): Optional. The existing axis to write the resulting figure to.
            figsize (tuple): Default (12,6). Size of the resulting figure. Ignored when ax is not None.


        Returns:
            (Axis): The figure's axis.

        >>> mvf.plot() # plots all forecasts and all series
        >>> plt.show()
        """
        if ax is None:
            _, ax = plt.subplots(figsize=figsize)

        series = self._parse_series(series)
        models = self._parse_models(models, put_best_on_top)

        k = 0
        for i, s in enumerate(series):
            plt.plot(
                self.current_dates.to_list(),
                self.y[s].to_list()[-len(self.current_dates) :],
                label=f"{s} actuals",
                ax=ax,
                color=__series_colors__[i],
            )
            for m in models:
                plt.plot(
                    self.future_dates.to_list(),
                    self.history[m]["Forecast"][s],
                    label=f"{s} {m}",
                    color=__colors__[k],
                    ax=ax,
                )

                if ci:
                    try:
                        ax.fill_between(
                            x=self.future_dates.to_list(),
                            y1=self.history[m]["UpperCI"][s],
                            y2=self.history[m]["LowerCI"][s],
                            alpha=0.2,
                            color=__colors__[k],
                            label="{} {} {:.0%} CI".format(
                                s, m, self.history[m]["CILevel"]
                            ),
                        )
                    except KeyError:
                        _developer_utils._warn_about_not_finding_cis(m)
                k += 1

        ax.legend()
        ax.set_xlabel("Date")
        ax.set_ylabel("Values")
        return ax
//  [python]
def plot(
        self, 
        models="all", 
        series="all", 
        put_best_on_top=False, 
        ci=False, 
        ax=None,
        figsize=(12,6),
    ):
        """ Plots all forecasts with the actuals, or just actuals if no forecasts have been evaluated or are selected.

        Args:
            models (list-like or str): Default 'all'.
               The forecasted models to plot.
               Name of the model, 'all', or list-like of model names.
               'top_' and None not supported.
            series (list-like or str): Default 'all'.
               The series to plot.
               Name of the series, 'all', or list-like of series names.
            put_best_on_top (bool): Only set to True if you have previously called set_best_model().
                If False, ignored.
            ci (bool): Default False.
                Whether to display the confidence intervals.
            ax (Axis): Optional. The existing axis to write the resulting figure to.
            figsize (tuple): Default (12,6). Size of the resulting figure. Ignored when ax is not None.


        Returns:
            (Axis): The figure's axis.

        >>> mvf.plot() # plots all forecasts and all series
        >>> plt.show()
        """
        if ax is None:
            _, ax = plt.subplots(figsize=figsize)

        series = self._parse_series(series)
        models = self._parse_models(models, put_best_on_top)

        k = 0
        for i, s in enumerate(series):
            sns.lineplot(
                x=self.current_dates.to_list(),
                y=self.y[s].to_list()[-len(self.current_dates) :],
                label=f"{s} actuals",
                ax=ax,
                color=__series_colors__[i],
            )
            for m in models:
                sns.lineplot(
                    x=self.future_dates.to_list(),
                    y=self.history[m]["Forecast"][s],
                    label=f"{s} {m}",
                    color=__colors__[k],
                    ax=ax,
                )

                if ci:
                    try:
                        ax.fill_between(
                            x=self.future_dates.to_list(),
                            y1=self.history[m]["UpperCI"][s],
                            y2=self.history[m]["LowerCI"][s],
                            alpha=0.2,
                            color=__colors__[k],
                            label="{} {} {:.0%} CI".format(
                                s, m, self.history[m]["CILevel"]
                            ),
                        )
                    except KeyError:
                        _developer_utils._warn_about_not_finding_cis(m)
                k += 1

        ax.legend()
        ax.set_xlabel("Date")
        ax.set_ylabel("Values")
        return ax
//  [python]
def plot_disentanglement_metrics(self, epoch_min=0, filename=None):
        """
        Parameters
        ----------
        epoch_min : int (default: 0)
            Epoch from which to show metrics history plot. Done for readability.

        filename : str (default: None)
            Name of the file to save the plot. If None, will automatically
            generate name from prefix file.
        """
        assert self.eval_metrics == True, 'The evaluation metrics were not computed'
        
        if filename is None:
            if self.fileprefix is None:
                filename = None
            else:
                filename = f"{self.fileprefix}_history_metrics.png"

        fig, axs = plt.subplots(
            1, 
            1+len(self.covariate_names), 
            sharex=True, 
            sharey=False, 
            figsize=(2 + 5*(len(self.covariate_names)), 3)
        )

        ax = plt.gca()
        sns.tsplot(
            data=self.disent[self.disent["epoch"] > epoch_min],
            time="epoch",
            value="perturbation disentanglement",
            unit="index",
            legend=False,
            ax=axs[0],
        )
        axs[0].set_title("perturbation disent", fontweight="bold")

        for i, cov in enumerate(self.covariate_names):
            sns.tsplot(
                data=self.disent[self.disent['epoch'] > epoch_min],
                time="epoch",
                value=f"{cov} disentanglement",
                unit="index",
                legend=False,
                ax=axs[1+i]
            )
            axs[1+i].set_title(f"{cov} disent", fontweight="bold")
        fig.tight_layout()
        sns.despine()
//  [python]
def plot_disentanglement_metrics(self, epoch_min=0, filename=None):
        """
        Parameters
        ----------
        epoch_min : int (default: 0)
            Epoch from which to show metrics history plot. Done for readability.

        filename : str (default: None)
            Name of the file to save the plot. If None, will automatically
            generate name from prefix file.
        """
        assert self.eval_metrics == True, 'The evaluation metrics were not computed'
        
        if filename is None:
            if self.fileprefix is None:
                filename = None
            else:
                filename = f"{self.fileprefix}_history_metrics.png"

        fig, axs = plt.subplots(
            1, 
            1+len(self.covariate_names), 
            sharex=True, 
            sharey=False, 
            figsize=(2 + 5*(len(self.covariate_names)), 3)
        )

        ax = plt.gca()
        sns.lineplot(
            data=self.disent[self.disent["epoch"] > epoch_min],
            x="epoch",
            y="perturbation disentanglement",
            legend=False,
            ax=axs[0],
        )
        axs[0].set_title("perturbation disent", fontweight="bold")

        for i, cov in enumerate(self.covariate_names):
            sns.lineplot(
                data=self.disent[self.disent['epoch'] > epoch_min],
                x="epoch",
                y=f"{cov} disentanglement",
                legend=False,
                ax=axs[1+i]
            )
            axs[1+i].set_title(f"{cov} disent", fontweight="bold")
        fig.tight_layout()
        sns.despine()
//  [python]
def make_bandwidth_vs_error_humabn_plot(return_pd=False):
    pd_yost = pd.read_csv("/home/francl/Bandwidth_Data.csv",header=[0])
    #conver bandwidths in fractions to numeric values
    pd_yost['bandwidth'] = pd_yost['bandwidth'].apply(eval)
    #Align Pure tone data with other pure tone points
    #Difference was caused by error in original CSV write
    pd_yost.iloc[7,1] = .001
    pd_yost.iloc[16,1] = .001
    #dummy column needed to add point makers with seaborn
    pd_yost['same_val'] = 1
    pd_yost.columns = ['frequency', 'Bandwidth (Octaves)', 'RMS Error (Degrees)',
                       'standard deviation', 'same_val']
    fig = plt.figure(figsize=(13,11))
    plt.clf()
    sns.pointplot(x='Bandwidth (Octaves)',y='RMS Error (Degrees)',hue="same_val",
                 lw=4,ms=10,legend=False,data=pd_yost,join=True,
                 markers=[""],err_style='bars',
                 err_kws={'mew':0,'elinewidth':4,'capthick':0},
                 dashes=False,palette=['k'])
    plt.xticks(rotation=90,size=30)
    plt.yticks(size=30)
    plt.ylim(5,25)
    plt.ylabel("RMS Error (Degrees)",size=40)
    plt.xlabel("Bandwidth (Octaves)",size=40)
    [x.set_color("black") for x in plt.gca().get_lines()]
    plt.tight_layout()
    pd_yost.to_csv(plots_folder+"/"+"yost_human_data_collapsed_bandwidth.csv")
    plt.savefig(plots_folder+"/"+"yost_human_data_collapsed_bandwidth.svg")
    if return_pd:
        return pd_yost
//  [python]
def make_bandwidth_vs_error_humabn_plot(return_pd=False):
    pd_yost = pd.read_csv("/home/francl/Bandwidth_Data.csv",header=[0])
    #conver bandwidths in fractions to numeric values
    pd_yost['bandwidth'] = pd_yost['bandwidth'].apply(eval)
    #Align Pure tone data with other pure tone points
    #Difference was caused by error in original CSV write
    pd_yost.iloc[7,1] = .001
    pd_yost.iloc[16,1] = .001
    #dummy column needed to add point makers with seaborn
    pd_yost['same_val'] = 1
    pd_yost.columns = ['frequency', 'Bandwidth (Octaves)', 'RMS Error (Degrees)',
                       'standard deviation', 'same_val']
    fig = plt.figure(figsize=(13,11))
    plt.clf()
    sns.lineplot(x='Bandwidth (Octaves)',y='RMS Error (Degrees)',hue="same_val",
                 lw=4,ms=10,legend=False,data=pd_yost,style="same_val",
                 markers=[""],err_style='bars',
                 err_kws={'mew':0,'elinewidth':4,'capthick':0},
                 dashes=False,palette=['k'])
    plt.xticks(rotation=90,size=30)
    plt.yticks(size=30)
    plt.ylim(5,25)
    plt.ylabel("RMS Error (Degrees)",size=40)
    plt.xlabel("Bandwidth (Octaves)",size=40)
    [x.set_color("black") for x in plt.gca().get_lines()]
    plt.tight_layout()
    pd_yost.to_csv(plots_folder+"/"+"yost_human_data_collapsed_bandwidth.csv")
    plt.savefig(plots_folder+"/"+"yost_human_data_collapsed_bandwidth.svg")
    if return_pd:
        return pd_yost
//  [python]
def make_wood_bizley_network_plot(regex=None):
    if regex is None:
        regex = ("/om5/user/francl/grp-om2/gahlm/dataset_pipeline_test/arch_number_*init_0/"
                 "batch_conditional_*_wood_bizley_03092022_iter100000*")
    pd_wood_bizley = make_dataframe(regex,elevation_predictions=True)
    pd_wood_bizley = format_wood_bizley_dataframe(pd_wood_bizley)
    #query breaks with negative numbers in this version of pandas
    snr_threshold = get_wood_bizley_snr_threshold_per_architecture(pd_wood_bizley)
    pd_wood_bizley_filtered = get_snr_threshold_trials(pd_wood_bizley,snr_threshold)
    #snr_val = -8
    #pd_wood_bizley_arch_mean = (pd_wood_bizley.query("snr == @snr_val")
    #                            .groupby(["azim_folded","arch_index","snr"])
    #                            ["azim_error_folded_abs"].mean().reset_index())
    pd_wood_bizley_arch_mean = (pd_wood_bizley_filtered
                                .query("calibrated_SNR_trial == True")
                                .groupby(["azim_folded","arch_index","snr"])
                                ["azim_error_folded_abs"].mean().reset_index())
    plt.clf()
    sns.pointplot(x="azim_folded",y="azim_error_folded_abs",data=pd_wood_bizley_arch_mean,
              ci=68,join=True,color='black',lw=3.1)
    plt.xticks([-90,-45,0,45,90])
    plt.xlim(-95,95)
    plt.ylim(0,30)
    #sns.lineplot(x="azim_folded",y="azim_error_folded_abs",data=pd_wood_bizley_arch_mean,
    #          units="arch_index",estimator=None)
    pd_wood_bizley = pd_wood_bizley_arch_mean.groupby("azim_folded")["azim_error_folded_abs"].mean().reset_index()
    pd_wood_bizley.columns = ['X', 'Y']
    plt.savefig(plots_folder+"/azimuth_vs_error_wood_graph_network.png")
    return pd_wood_bizley
//  [python]
def make_wood_bizley_network_plot(regex=None):
    if regex is None:
        regex = ("/om5/user/francl/grp-om2/gahlm/dataset_pipeline_test/arch_number_*init_0/"
                 "batch_conditional_*_wood_bizley_03092022_iter100000*")
    pd_wood_bizley = make_dataframe(regex,elevation_predictions=True)
    pd_wood_bizley = format_wood_bizley_dataframe(pd_wood_bizley)
    #query breaks with negative numbers in this version of pandas
    snr_threshold = get_wood_bizley_snr_threshold_per_architecture(pd_wood_bizley)
    pd_wood_bizley_filtered = get_snr_threshold_trials(pd_wood_bizley,snr_threshold)
    #snr_val = -8
    #pd_wood_bizley_arch_mean = (pd_wood_bizley.query("snr == @snr_val")
    #                            .groupby(["azim_folded","arch_index","snr"])
    #                            ["azim_error_folded_abs"].mean().reset_index())
    pd_wood_bizley_arch_mean = (pd_wood_bizley_filtered
                                .query("calibrated_SNR_trial == True")
                                .groupby(["azim_folded","arch_index","snr"])
                                ["azim_error_folded_abs"].mean().reset_index())
    plt.clf()
    sns.lineplot(x="azim_folded",y="azim_error_folded_abs",data=pd_wood_bizley_arch_mean,
              ci=68,err_style="bars",color='black',lw=3.1,
              err_kws={'capsize':0.1,'elinewidth':3,'capthick':0.1})
    plt.xticks([-90,-45,0,45,90])
    plt.xlim(-95,95)
    plt.ylim(0,30)
    #sns.lineplot(x="azim_folded",y="azim_error_folded_abs",data=pd_wood_bizley_arch_mean,
    #          units="arch_index",estimator=None)
    pd_wood_bizley = pd_wood_bizley_arch_mean.groupby("azim_folded")["azim_error_folded_abs"].mean().reset_index()
    pd_wood_bizley.columns = ['X', 'Y']
    plt.savefig(plots_folder+"/azimuth_vs_error_wood_graph_network.png")
    return pd_wood_bizley
//  [python]
def make_hebrank_wright_plots(pd_hebrank_wright_formatted,y_axis="correct_within_15"):
    plt.clf()
    pd_hebrank_wright_arch_mean = (pd_hebrank_wright_formatted
                                   .groupby(['low_cutoff','high_cutoff','arch_index'])
                                   .mean().reset_index())
    pd_hebrank_wright_arch_mean_low = pd_hebrank_wright_arch_mean.query("low_cutoff == 20 & high_cutoff != 20000")
    pd_hebrank_wright_arch_mean_high = pd_hebrank_wright_arch_mean.query("high_cutoff == 20000 & low_cutoff != 20")
    g = sns.pointplot(data=pd_hebrank_wright_arch_mean_low,x="high_cutoff",y=y_axis,ci=68,
                     errwidth=1,join=True,markers='o',scale=0.75)
    sns.pointplot(data=pd_hebrank_wright_arch_mean_high,x="low_cutoff",y=y_axis,ci=68,
                    errwidth=1,join=True,markers='o',scale=0.75)
    g.set(xticklabels=[])
    g.set_xscale('log')
    g.set_yticks([0,.2,.4,.6,.8,1.0])
    g.set_yticklabels([0,.2,.4,.6,.8,1.0],fontsize=10)
    g.set_xticks([4000,6000,8000,10000,12000,15000,18000])
    g.set_xticklabels([4000,6000,8000,10000,12000,15000,18000],fontsize=10,rotation=45)
    g.set_ylabel("Proportion of Correct Responses",fontsize=10)
    g.set_xlabel("Cutoff Frequency (Hz)",fontsize=10)
    #plt.legend(["Low Pass","High Pass"],title="Filtering Condition",fontsize=15)
    pd_hebrank_wright_arch_mean.to_csv(plots_folder + "/hebrank_wright.csv")
    plt.savefig(plots_folder+"/hebrank_wright_{}.svg".format(y_axis))
//  [python]
def make_hebrank_wright_plots(pd_hebrank_wright_formatted,y_axis="correct_within_15"):
    plt.clf()
    pd_hebrank_wright_arch_mean = (pd_hebrank_wright_formatted
                                   .groupby(['low_cutoff','high_cutoff','arch_index'])
                                   .mean().reset_index())
    pd_hebrank_wright_arch_mean_low = pd_hebrank_wright_arch_mean.query("low_cutoff == 20 & high_cutoff != 20000")
    pd_hebrank_wright_arch_mean_high = pd_hebrank_wright_arch_mean.query("high_cutoff == 20000 & low_cutoff != 20")
    g = sns.lineplot(data=pd_hebrank_wright_arch_mean_low,x="high_cutoff",y=y_axis,ci=68,
                     err_style='bars',lw=0.75)
    sns.lineplot(data=pd_hebrank_wright_arch_mean_high,x="low_cutoff",y=y_axis,ci=68,
                    err_style='bars',lw=0.75)
    g.set(xticklabels=[])
    g.set_xscale('log')
    g.set_yticks([0,.2,.4,.6,.8,1.0])
    g.set_yticklabels([0,.2,.4,.6,.8,1.0],fontsize=10)
    g.set_xticks([4000,6000,8000,10000,12000,15000,18000])
    g.set_xticklabels([4000,6000,8000,10000,12000,15000,18000],fontsize=10,rotation=45)
    g.set_ylabel("Proportion of Correct Responses",fontsize=10)
    g.set_xlabel("Cutoff Frequency (Hz)",fontsize=10)
    #plt.legend(["Low Pass","High Pass"],title="Filtering Condition",fontsize=15)
    pd_hebrank_wright_arch_mean.to_csv(plots_folder + "/hebrank_wright.csv")
    plt.savefig(plots_folder+"/hebrank_wright_{}.svg".format(y_axis))
//  [python]
def make_hebrank_wright_human_plot():
    pd_hebrank_wright_human = get_hebrank_wright_human_data()
    plt.clf()
    hue_order = ["low_pass","high_pass"]
    g = sns.tsplot(data=pd_hebrank_wright_human,time="Frequency (Hz)",
                 value="Proportion of Correct Responses",unit="Subject",condition="Filtering Condition",
                 hue_order=hue_order,err_style='bars',
                 markers=["o","o"],dashes=False,ms=2.0,mew=0.05,lw=0.75)
    g.set(xticklabels=[])
    g.set_xscale('log')
    g.set_yticks([0,.2,.4,.6,.8,1.0])
    g.set_yticklabels([0,.2,.4,.6,.8,1.0],fontsize=10)
    g.set_xticks([4000,6000,8000,10000,12000,15000,18000])
    g.set_xticklabels([4000,6000,8000,10000,12000,15000,18000],fontsize=10,rotation=45)
    g.set_ylabel("Proportion of Correct Responses",fontsize=10)
    g.set_xlabel("Cutoff Frequency (Hz)",fontsize=10)
    #plt.xscale('log')
    #plt.yticks([0,.2,.4,.6,.8,1.0],fontsize=10)
    #plt.xticks([4000,6000,8000,10000,12000,15000,18000],fontsize=10,rotation=45)
    #plt.ylabel("Proportion of Correct Responses",fontsize=10)
    #plt.xlabel("Cutoff Frequency (Hz)",fontsize=10)
    plt.legend(["Low Pass","High Pass"],title="Filtering Condition",fontsize=15)
    plt.savefig(plots_folder+"/hebrank_wright_human_data.svg")
//  [python]
def make_hebrank_wright_human_plot():
    pd_hebrank_wright_human = get_hebrank_wright_human_data()
    plt.clf()
    hue_order = ["low_pass","high_pass"]
    g = sns.lineplot(data=pd_hebrank_wright_human,x="Frequency (Hz)",
                 y="Proportion of Correct Responses",hue="Filtering Condition",
                 style="Filtering Condition",hue_order=hue_order,err_style='bars',
                 markers=["o","o"],dashes=False,ms=2.0,mew=0.05,lw=0.75)
    g.set(xticklabels=[])
    g.set_xscale('log')
    g.set_yticks([0,.2,.4,.6,.8,1.0])
    g.set_yticklabels([0,.2,.4,.6,.8,1.0],fontsize=10)
    g.set_xticks([4000,6000,8000,10000,12000,15000,18000])
    g.set_xticklabels([4000,6000,8000,10000,12000,15000,18000],fontsize=10,rotation=45)
    g.set_ylabel("Proportion of Correct Responses",fontsize=10)
    g.set_xlabel("Cutoff Frequency (Hz)",fontsize=10)
    #plt.xscale('log')
    #plt.yticks([0,.2,.4,.6,.8,1.0],fontsize=10)
    #plt.xticks([4000,6000,8000,10000,12000,15000,18000],fontsize=10,rotation=45)
    #plt.ylabel("Proportion of Correct Responses",fontsize=10)
    #plt.xlabel("Cutoff Frequency (Hz)",fontsize=10)
    plt.legend(["Low Pass","High Pass"],title="Filtering Condition",fontsize=15)
    plt.savefig(plots_folder+"/hebrank_wright_human_data.svg")
//  [python]
def make_click_precedence_effect_plot(regex=None):
    if regex is None:
        regex = ("/om2/user/francl/grp-om2/gahlm/dataset_pipeline_test/"
                 "arch_number_*init_0/batch_conditional_precedenceEffectRecords"
                 "_45DegOffset_jitteredStart_jitteredPt5msDelay_expanded_stackedCH*iter100000*")
        pd_dataframe_precedence = make_dataframe(regex,fold_data=True)
        pd_dataframe_precedence = format_click_precedence_effect_dataframe(pd_dataframe_precedence)
        pd_filtered_precedence = pd_dataframe_precedence[(pd_dataframe_precedence['Lead Click Position'].isin([45])) & (pd_dataframe_precedence['Lead Click Level Difference (dB)'].isin([0]))].astype('int32')
        pd_filtered_precedence_arch_mean = pd_filtered_precedence.groupby(['arch_index','delay','Lead Click Level Difference (dB)']).mean().reset_index()
        plt.clf()
        plt.figure()
        s.tsplot(data=pd_filtered_precedence_arch_mean, time="delay", unit="arch_index", condition="Lead Click Level Difference (dB)", value="predicted_folded", color='k', err_style='bars', ci=68, lw=1.0)
        format_precedence_effect_graph()
        plt.yticks([-40,-20,0,20,40])
        plt.xticks([0,10,20,30,40,50])
        plt.tight_layout()
        pd_filtered_precedence_arch_mean.to_csv(plots_folder+"/"+"precedence_effect_graph_lineplot_clicks.csv")
        plt.savefig(plots_folder+"/"+"precedence_effect_graph_lineplot_clicks.svg")