jiahuimbzuai/CoQuIR huggingface dataset:
//  [python]
def plot_human_exp_1(df, palette, plot_dir):
    plt.rcParams["font.family"] = "Avenir"
    plt.rcParams["font.size"] = 24

    grouped_df = df.groupby(['Question', 'Survey Type']).sum().unstack()
    grouped_df = grouped_df.reindex(['BigTom (Ours)', 'socialIQa', 'Expert'], level='Survey Type', axis=1)

    fig, ax = plt.subplots(figsize=(15, 5))
    grouped_df['Median Rating'].plot(kind='bar', ax=ax, width=0.8, color=[palette[i] for i in grouped_df['Median Rating'].columns], zorder=10)

    for patch in ax.patches:
        bb = patch.get_bbox()
        color = patch.get_facecolor()
        p_bbox = get_fancy_bbox(bb, "round,pad=-0.005,rounding_size=0.02", color, mutation_aspect=4)
        patch.remove()
        ax.add_patch(p_bbox)

    for i, bar in enumerate(ax.patches):
        yerr = grouped_df['Error'].values.T.flatten()[i]
        lower_error = bar.get_height() - yerr[0]
        upper_error = yerr[1] - bar.get_height()
        yerr = np.array([[lower_error], [upper_error]])
        bar_color = "black"
        lighter_bar_color = lighten_color(bar_color, 0.8)
        
        ax.errorbar(bar.get_x() + bar.get_width() / 2, bar.get_height(), yerr=yerr, color=lighter_bar_color, capsize=1, ls='none', elinewidth=2, zorder=40)

    plt.xticks(rotation=0)
    sns.despine(left=True, bottom=False)
    plt.xlabel('')
    plt.legend(title='', frameon=False, ncol=4)
    fmt = FuncFormatter(lambda y, _: '{:.0%}'.format(y / 5))
    ax.yaxis.set_major_formatter(fmt)
    ax.yaxis.set_major_locator(MultipleLocator(1))
    ax.set_yticks([1, 2, 3, 4, 5])
    ax.set_yticklabels(['1', '2', '3', '4', '5'])
    ax.yaxis.grid(True, linestyle='-', which='major', color='lightgrey', alpha=0.5, zorder=-100)
    plt.tick_params(axis='y', length=0)
    ax.set_ylabel('Average Rating')
    ax.yaxis.set_label_coords(-0.03, 0.4)
    plt.ylim(0.02, 7)
    plt.savefig(f"{plot_dir}/exp_1_average_ratings.pdf", format='pdf', bbox_inches='tight')
//  [python]
def plot_human_exp_1(df, palette, plot_dir):
    plt.rcParams["font.family"] = "Avenir"
    plt.rcParams["font.size"] = 24

    grouped_df = df.groupby(['Question', 'Survey Type']).sum().unstack()
    grouped_df = grouped_df.reindex(['BigTom (Ours)', 'socialIQa', 'Expert'], level='Survey Type', axis=1)

    fig, ax = plt.subplots(figsize=(15, 5))
    grouped_df['Median Rating'].plot(kind='bar', ax=ax, width=0.8, color=[palette[i] for i in grouped_df['Median Rating'].columns], zorder=10)

    for patch in ax.patches:
        bb = patch.get_bbox()
        color = patch.get_facecolor()
        p_bbox = get_fancy_bbox(bb, "round,pad=-0.005,rounding_size=0.02", color, mutation_aspect=4)
        patch.remove()
        ax.add_patch(p_bbox)

    for i, bar in enumerate(ax.patches):
        yerr = grouped_df['Error'].values.T.flatten()[i]
        lower_error = bar.get_height() - yerr[0]
        upper_error = yerr[1] - bar.get_height()
        yerr = np.array([[lower_error], [upper_error]])
        bar_color = "black"
        lighter_bar_color = lighten_color(bar_color, 0.8)
        
        ax.errorbar(bar.get_x() + bar.get_width() / 2, bar.get_height(), yerr=yerr, color=lighter_bar_color, capsize=1, ls='none', elinewidth=2, zorder=40)

    plt.xticks(rotation=0)
    sns.utils.despine(left=True, bottom=False)
    plt.xlabel('')
    plt.legend(title='', frameon=False, ncol=4)
    fmt = FuncFormatter(lambda y, _: '{:.0%}'.format(y / 5))
    ax.yaxis.set_major_formatter(fmt)
    ax.yaxis.set_major_locator(MultipleLocator(1))
    ax.set_yticks([1, 2, 3, 4, 5])
    ax.set_yticklabels(['1', '2', '3', '4', '5'])
    ax.yaxis.grid(True, linestyle='-', which='major', color='lightgrey', alpha=0.5, zorder=-100)
    plt.tick_params(axis='y', length=0)
    ax.set_ylabel('Average Rating')
    ax.yaxis.set_label_coords(-0.03, 0.4)
    plt.ylim(0.02, 7)
    plt.savefig(f"{plot_dir}/exp_1_average_ratings.pdf", format='pdf', bbox_inches='tight')
//  [python]
df = df.transpose()
df = df.rename(index={f"score_{i}": str(i) for i in range(2, 21)})
df = df[
    [
        "LINEARLY SEPARABLE",
        "MNIST PCA-",
        "HIDDEN MANIFOLD",
        "TWO CURVES",
        "HYPERPLANES DIFF",
        "HIDDEN MANIFOLD DIFF",
        "TWO CURVES DIFF",
    ]
]

df.plot(
    style={
        "LINEARLY SEPARABLE": "gold",
        "MNIST PCA-": "darkorange",
        "HIDDEN MANIFOLD": "darkgoldenrod",
        "TWO CURVES": "tan",
        "HIDDEN MANIFOLD DIFF": "midnightblue",
        "TWO CURVES DIFF": "deeppink",
        "HYPERPLANES DIFF": "darkviolet",
    },
    lw=2.3
)
sns.despine()
//  [python]
df = df.transpose()
df = df.rename(index={f"score_{i}": str(i) for i in range(2, 21)})
df = df[
    [
        "LINEARLY SEPARABLE",
        "MNIST PCA-",
        "HIDDEN MANIFOLD",
        "TWO CURVES",
        "HYPERPLANES DIFF",
        "HIDDEN MANIFOLD DIFF",
        "TWO CURVES DIFF",
    ]
]

df.plot(
    style={
        "LINEARLY SEPARABLE": "gold",
        "MNIST PCA-": "darkorange",
        "HIDDEN MANIFOLD": "darkgoldenrod",
        "TWO CURVES": "tan",
        "HIDDEN MANIFOLD DIFF": "midnightblue",
        "TWO CURVES DIFF": "deeppink",
        "HYPERPLANES DIFF": "darkviolet",
    },
    lw=2.3
)
sns.utils.despine()
//  [python]
def plot_distance_corrs(subjects, axes, exp):

    for subj, ax in zip(subjects, axes):

        res_fname = "correlation_analysis/{}_{}_ifs.pkz".format(subj, exp)
        res = moss.load_pkl(res_fname)
        x = res.distance_thresh

        for dim, color, marker in zip(["3D", "2D"], [".5", ".2"], ["x", "+"]):
            same, diff = res.corr_distance[dim].T
            ax.plot(x, same - diff, "o-", color=color, ms=3, clip_on=False)

            sig = res.corr_distance_pctiles[dim] > 95
            stary = -.005 if exp == "dots" else -.0025
            ax.plot(x[sig], np.ones(sig.sum()) * stary,
                    marker=marker, ls="", mew=.35, mec=".2", ms=3)

        ylim = (-.01, .08) if exp == "dots" else (-.005, .04)
        yticks = np.array([0, .01, .02, .03, .04])
        yticks =  yticks * 2 if exp == "dots" else yticks
        ax.set(xlim=(-2, 42), ylim=ylim, yticks=yticks)
        sns.despine(ax=ax, trim=True)

    ylabel = "Subnetwork strength\n($r_{\mathrm{same}} - r_{\mathrm{diff}}$)"
    plt.setp(axes[1:7], yticklabels=[])
    axes[0].set_ylabel(ylabel)

    if exp == "dots":
        plt.setp(axes[8:], yticklabels=[])
        plt.setp(axes[:7], xticklabels=[])
        axes[7].set_ylabel(ylabel)
//  [python]
def plot_distance_corrs(subjects, axes, exp):

    for subj, ax in zip(subjects, axes):

        res_fname = "correlation_analysis/{}_{}_ifs.pkz".format(subj, exp)
        res = moss.load_pkl(res_fname)
        x = res.distance_thresh

        for dim, color, marker in zip(["3D", "2D"], [".5", ".2"], ["x", "+"]):
            same, diff = res.corr_distance[dim].T
            ax.plot(x, same - diff, "o-", color=color, ms=3, clip_on=False)

            sig = res.corr_distance_pctiles[dim] > 95
            stary = -.005 if exp == "dots" else -.0025
            ax.plot(x[sig], np.ones(sig.sum()) * stary,
                    marker=marker, ls="", mew=.35, mec=".2", ms=3)

        ylim = (-.01, .08) if exp == "dots" else (-.005, .04)
        yticks = np.array([0, .01, .02, .03, .04])
        yticks =  yticks * 2 if exp == "dots" else yticks
        ax.set(xlim=(-2, 42), ylim=ylim, yticks=yticks)
        sns.utils.despine(ax=ax, trim=True)

    ylabel = "Subnetwork strength\n($r_{\mathrm{same}} - r_{\mathrm{diff}}$)"
    plt.setp(axes[1:7], yticklabels=[])
    axes[0].set_ylabel(ylabel)

    if exp == "dots":
        plt.setp(axes[8:], yticklabels=[])
        plt.setp(axes[:7], xticklabels=[])
        axes[7].set_ylabel(ylabel)
//  [python]
def plot_model_diagnostic_lineplots(gs_placement, axs_placement):

    r2_ftr_str = "r2_score_vs_featsize_" + suffix
    r2_trn_str = "r2_score_vs_trainsize_" + suffix

    prefixes = [r2_ftr_str, r2_trn_str]

    for col, t in enumerate(["Feature Vector Size (K)", "Training Set Size (N)"]):
        plot_handles = []
        fill_handles = []
        labs = []
        maxxval = 0
        minxval = np.inf
        ax = plt.subplot(gs_placement[col])
        for app in c.app_order:
            c_app = getattr(c, app)
            title = c_app["disp_name"]
            vals = load_app_data(app, prefixes[col])
            x = vals["x_vals"]
            maxxval = max(maxxval, max(x))
            minxval = min(minxval, min(x))
            y = np.array(vals["y_vals"])
            y_mean = y.mean(axis=0)
            y_min = y.min(axis=0)
            y_max = y.max(axis=0)

            p0 = ax.semilogx(x, y_mean, label=title, color=c_app["color"])
            p1 = ax.fill_between(
                x, y_min, y_max, color=c_app["color"], alpha=0.5, linewidth=0
            )
            plot_handles.append(p0[0])
            fill_handles.append(p1)
            labs.append(title)
            ax.set_xlabel(t)
            ax.set_ylim(-0.1, 1)
            ax.set_yticks(YTICKS)
            ax.set_xlim(minxval, maxxval)
            sns.despine(ax=ax)
        axs_placement.append(ax)

    axs_placement[0].set_ylabel("$R^2$")
    axs_placement[0].set_yticklabels(YTICKLABELS)
    axs_placement[1].set_yticklabels([""] * len(YTICKS))

    # add legends for these plots
    handles = [(plot, fill_handles[ix]) for ix, plot in enumerate(plot_handles)]
    return handles
//  [python]
def plot_model_diagnostic_lineplots(gs_placement, axs_placement):

    r2_ftr_str = "r2_score_vs_featsize_" + suffix
    r2_trn_str = "r2_score_vs_trainsize_" + suffix

    prefixes = [r2_ftr_str, r2_trn_str]

    for col, t in enumerate(["Feature Vector Size (K)", "Training Set Size (N)"]):
        plot_handles = []
        fill_handles = []
        labs = []
        maxxval = 0
        minxval = np.inf
        ax = plt.subplot(gs_placement[col])
        for app in c.app_order:
            c_app = getattr(c, app)
            title = c_app["disp_name"]
            vals = load_app_data(app, prefixes[col])
            x = vals["x_vals"]
            maxxval = max(maxxval, max(x))
            minxval = min(minxval, min(x))
            y = np.array(vals["y_vals"])
            y_mean = y.mean(axis=0)
            y_min = y.min(axis=0)
            y_max = y.max(axis=0)

            p0 = ax.semilogx(x, y_mean, label=title, color=c_app["color"])
            p1 = ax.fill_between(
                x, y_min, y_max, color=c_app["color"], alpha=0.5, linewidth=0
            )
            plot_handles.append(p0[0])
            fill_handles.append(p1)
            labs.append(title)
            ax.set_xlabel(t)
            ax.set_ylim(-0.1, 1)
            ax.set_yticks(YTICKS)
            ax.set_xlim(minxval, maxxval)
            sns.utils.despine(ax=ax)
        axs_placement.append(ax)

    axs_placement[0].set_ylabel("$R^2$")
    axs_placement[0].set_yticklabels(YTICKLABELS)
    axs_placement[1].set_yticklabels([""] * len(YTICKS))

    # add legends for these plots
    handles = [(plot, fill_handles[ix]) for ix, plot in enumerate(plot_handles)]
    return handles
//  [python]
def plot_embedding(
        emb,
        labels=None,
        col_dict=None,
        title=None,
        show_lines=False,
        show_text=False,
        show_legend=True,
        axis_equal=True,
        circle_size=40,
        circe_transparency=1.0,
        line_transparency=0.8,
        line_width=1.0,
        fontsize=9,
        fig_width=4,
        fig_height=4,
        file_name=None,
        file_format=None,
        labels_name=None,
        width_ratios=[7, 1],
        bbox=(1.3, 0.7)
):
    sns.set_style("white")

    # create data structure suitable for embedding
    df = pd.DataFrame(emb, columns=['dim1', 'dim2'])
    if not (labels is None):
        if labels_name is None:
            labels_name = 'labels'
        df[labels_name] = labels

    fig = plt.figure(figsize=(fig_width, fig_height))
    ax = plt.gca()

    sns.despine(left=False, bottom=False, right=True)

    if (col_dict is None) and not (labels is None):
        col_dict = get_colors(labels)

    sns.scatterplot(
        x="dim1",
        y="dim2",
        hue=labels_name,
        palette=col_dict,
        alpha=circe_transparency,
        edgecolor="none",
        s=circle_size,
        data=df,
        ax=ax)

    try:
        ax.legend_.remove()
    except:
        pass

    if show_lines:
        for i in range(len(emb)):
            if col_dict is None:
                ax.plot(
                    [0, emb[i, 0]],
                    [0, emb[i, 1]],
                    alpha=line_transparency,
                    linewidth=line_width,
                    c=None
                )
            else:
                ax.plot(
                    [0, emb[i, 0]],
                    [0, emb[i, 1]],
                    alpha=line_transparency,
                    linewidth=line_width,
                    c=col_dict[labels[i]]
                )

    if show_text and not (labels is None):
        texts = []
        labels = np.array(labels)
        unique_labels = np.unique(labels)
        for label in unique_labels:
            idx_label = np.where(labels == label)[0]
            texts.append(
                ax.text(
                    np.mean(emb[idx_label, 0]),
                    np.mean(emb[idx_label, 1]),
                    label,
                    fontsize=fontsize
                )
            )

        adjust_text(
            texts,
            arrowprops=dict(arrowstyle='-', color='black', lw=0.1),
            ax=ax
        )

    if axis_equal:
        ax.axis('equal')
        ax.axis('square')

    if title:
        ax.set_title(title, fontsize=fontsize, fontweight="bold")

    ax.set_xlabel('dim1', fontsize=fontsize)
    ax.set_ylabel('dim2', fontsize=fontsize)
    ax.xaxis.set_tick_params(labelsize=fontsize)
    ax.yaxis.set_tick_params(labelsize=fontsize)

    plt.tight_layout()

    if file_name:
        save_to_file(fig, file_name, file_format)

    return plt
//  [python]
def plot_embedding(
        emb,
        labels=None,
        col_dict=None,
        title=None,
        show_lines=False,
        show_text=False,
        show_legend=True,
        axis_equal=True,
        circle_size=40,
        circe_transparency=1.0,
        line_transparency=0.8,
        line_width=1.0,
        fontsize=9,
        fig_width=4,
        fig_height=4,
        file_name=None,
        file_format=None,
        labels_name=None,
        width_ratios=[7, 1],
        bbox=(1.3, 0.7)
):
    sns.set_style("white")

    # create data structure suitable for embedding
    df = pd.DataFrame(emb, columns=['dim1', 'dim2'])
    if not (labels is None):
        if labels_name is None:
            labels_name = 'labels'
        df[labels_name] = labels

    fig = plt.figure(figsize=(fig_width, fig_height))
    ax = plt.gca()

    sns.utils.despine(left=False, bottom=False, right=True)

    if (col_dict is None) and not (labels is None):
        col_dict = get_colors(labels)

    sns.scatterplot(
        x="dim1",
        y="dim2",
        hue=labels_name,
        palette=col_dict,
        alpha=circe_transparency,
        edgecolor="none",
        s=circle_size,
        data=df,
        ax=ax)

    try:
        ax.legend_.remove()
    except:
        pass

    if show_lines:
        for i in range(len(emb)):
            if col_dict is None:
                ax.plot(
                    [0, emb[i, 0]],
                    [0, emb[i, 1]],
                    alpha=line_transparency,
                    linewidth=line_width,
                    c=None
                )
            else:
                ax.plot(
                    [0, emb[i, 0]],
                    [0, emb[i, 1]],
                    alpha=line_transparency,
                    linewidth=line_width,
                    c=col_dict[labels[i]]
                )

    if show_text and not (labels is None):
        texts = []
        labels = np.array(labels)
        unique_labels = np.unique(labels)
        for label in unique_labels:
            idx_label = np.where(labels == label)[0]
            texts.append(
                ax.text(
                    np.mean(emb[idx_label, 0]),
                    np.mean(emb[idx_label, 1]),
                    label,
                    fontsize=fontsize
                )
            )

        adjust_text(
            texts,
            arrowprops=dict(arrowstyle='-', color='black', lw=0.1),
            ax=ax
        )

    if axis_equal:
        ax.axis('equal')
        ax.axis('square')

    if title:
        ax.set_title(title, fontsize=fontsize, fontweight="bold")

    ax.set_xlabel('dim1', fontsize=fontsize)
    ax.set_ylabel('dim2', fontsize=fontsize)
    ax.xaxis.set_tick_params(labelsize=fontsize)
    ax.yaxis.set_tick_params(labelsize=fontsize)

    plt.tight_layout()

    if file_name:
        save_to_file(fig, file_name, file_format)

    return plt
//  [python]
def figure_basic(self, plot_S='line', plot_E='line', plot_I='line',plot_R='line', plot_F='line',
                        plot_Q_E='line', plot_Q_I='line', combine_Q=True,
                        color_S='tab:green', color_E='orange', color_I='crimson', color_R='tab:blue', color_F='black',
                        color_Q_E='mediumorchid', color_Q_I='mediumorchid', color_reference='#E0E0E0',
                        dashed_reference_results=None, dashed_reference_label='reference', 
                        shaded_reference_results=None, shaded_reference_label='reference', 
                        vlines=[], vline_colors=[], vline_styles=[], vline_labels=[],
                        ylim=None, xlim=None, legend=True, title=None, side_title=None, plot_percentages=True,
                        figsize=(12,8), use_seaborn=True, show=True):

        import matplotlib.pyplot as pyplot

        fig, ax = pyplot.subplots(figsize=figsize)

        if(use_seaborn):
            import seaborn
            seaborn.set_style('ticks')
            seaborn.despine()

        self.plot(ax=ax, plot_S=plot_S, plot_E=plot_E, plot_I=plot_I,plot_R=plot_R, plot_F=plot_F,
                        plot_Q_E=plot_Q_E, plot_Q_I=plot_Q_I, combine_Q=combine_Q,
                        color_S=color_S, color_E=color_E, color_I=color_I, color_R=color_R, color_F=color_F,
                        color_Q_E=color_Q_E, color_Q_I=color_Q_I, color_reference=color_reference,
                        dashed_reference_results=dashed_reference_results, dashed_reference_label=dashed_reference_label, 
                        shaded_reference_results=shaded_reference_results, shaded_reference_label=shaded_reference_label, 
                        vlines=vlines, vline_colors=vline_colors, vline_styles=vline_styles, vline_labels=vline_labels,
                        ylim=ylim, xlim=xlim, legend=legend, title=title, side_title=side_title, plot_percentages=plot_percentages)

        if(show):
            pyplot.show()

        return fig, ax
//  [python]
def figure_basic(self, plot_S='line', plot_E='line', plot_I='line',plot_R='line', plot_F='line',
                        plot_Q_E='line', plot_Q_I='line', combine_Q=True,
                        color_S='tab:green', color_E='orange', color_I='crimson', color_R='tab:blue', color_F='black',
                        color_Q_E='mediumorchid', color_Q_I='mediumorchid', color_reference='#E0E0E0',
                        dashed_reference_results=None, dashed_reference_label='reference', 
                        shaded_reference_results=None, shaded_reference_label='reference', 
                        vlines=[], vline_colors=[], vline_styles=[], vline_labels=[],
                        ylim=None, xlim=None, legend=True, title=None, side_title=None, plot_percentages=True,
                        figsize=(12,8), use_seaborn=True, show=True):

        import matplotlib.pyplot as pyplot

        fig, ax = pyplot.subplots(figsize=figsize)

        if(use_seaborn):
            import seaborn
            seaborn.set_style('ticks')
            seaborn.utils.despine()

        self.plot(ax=ax, plot_S=plot_S, plot_E=plot_E, plot_I=plot_I,plot_R=plot_R, plot_F=plot_F,
                        plot_Q_E=plot_Q_E, plot_Q_I=plot_Q_I, combine_Q=combine_Q,
                        color_S=color_S, color_E=color_E, color_I=color_I, color_R=color_R, color_F=color_F,
                        color_Q_E=color_Q_E, color_Q_I=color_Q_I, color_reference=color_reference,
                        dashed_reference_results=dashed_reference_results, dashed_reference_label=dashed_reference_label, 
                        shaded_reference_results=shaded_reference_results, shaded_reference_label=shaded_reference_label, 
                        vlines=vlines, vline_colors=vline_colors, vline_styles=vline_styles, vline_labels=vline_labels,
                        ylim=ylim, xlim=xlim, legend=legend, title=title, side_title=side_title, plot_percentages=plot_percentages)

        if(show):
            pyplot.show()

        return fig, ax
//  [python]
def figure_infections(self, plot_S=False, plot_E='stacked', plot_I='stacked',plot_R=False, plot_F=False,
                            plot_Q_E='stacked', plot_Q_I='stacked', combine_Q=True,
                            color_S='tab:green', color_E='orange', color_I='crimson', color_R='tab:blue', color_F='black',
                            color_Q_E='mediumorchid', color_Q_I='mediumorchid', color_reference='#E0E0E0',
                            dashed_reference_results=None, dashed_reference_label='reference', 
                            shaded_reference_results=None, shaded_reference_label='reference', 
                            vlines=[], vline_colors=[], vline_styles=[], vline_labels=[],
                            ylim=None, xlim=None, legend=True, title=None, side_title=None, plot_percentages=True,
                            figsize=(12,8), use_seaborn=True, show=True):

        import matplotlib.pyplot as pyplot

        fig, ax = pyplot.subplots(figsize=figsize)

        if(use_seaborn):
            import seaborn
            seaborn.set_style('ticks')
            seaborn.despine()

        self.plot(ax=ax, plot_S=plot_S, plot_E=plot_E, plot_I=plot_I,plot_R=plot_R, plot_F=plot_F,
                        plot_Q_E=plot_Q_E, plot_Q_I=plot_Q_I, combine_Q=combine_Q,
                        color_S=color_S, color_E=color_E, color_I=color_I, color_R=color_R, color_F=color_F,
                        color_Q_E=color_Q_E, color_Q_I=color_Q_I, color_reference=color_reference,
                        dashed_reference_results=dashed_reference_results, dashed_reference_label=dashed_reference_label, 
                        shaded_reference_results=shaded_reference_results, shaded_reference_label=shaded_reference_label, 
                        vlines=vlines, vline_colors=vline_colors, vline_styles=vline_styles, vline_labels=vline_labels, 
                        ylim=ylim, xlim=xlim, legend=legend, title=title, side_title=side_title, plot_percentages=plot_percentages)

        if(show):
            pyplot.show()

        return fig, ax
//  [python]
def figure_infections(self, plot_S=False, plot_E='stacked', plot_I='stacked',plot_R=False, plot_F=False,
                            plot_Q_E='stacked', plot_Q_I='stacked', combine_Q=True,
                            color_S='tab:green', color_E='orange', color_I='crimson', color_R='tab:blue', color_F='black',
                            color_Q_E='mediumorchid', color_Q_I='mediumorchid', color_reference='#E0E0E0',
                            dashed_reference_results=None, dashed_reference_label='reference', 
                            shaded_reference_results=None, shaded_reference_label='reference', 
                            vlines=[], vline_colors=[], vline_styles=[], vline_labels=[],
                            ylim=None, xlim=None, legend=True, title=None, side_title=None, plot_percentages=True,
                            figsize=(12,8), use_seaborn=True, show=True):

        import matplotlib.pyplot as pyplot

        fig, ax = pyplot.subplots(figsize=figsize)

        if(use_seaborn):
            import seaborn
            seaborn.set_style('ticks')
            seaborn.utils.despine()

        self.plot(ax=ax, plot_S=plot_S, plot_E=plot_E, plot_I=plot_I,plot_R=plot_R, plot_F=plot_F,
                        plot_Q_E=plot_Q_E, plot_Q_I=plot_Q_I, combine_Q=combine_Q,
                        color_S=color_S, color_E=color_E, color_I=color_I, color_R=color_R, color_F=color_F,
                        color_Q_E=color_Q_E, color_Q_I=color_Q_I, color_reference=color_reference,
                        dashed_reference_results=dashed_reference_results, dashed_reference_label=dashed_reference_label, 
                        shaded_reference_results=shaded_reference_results, shaded_reference_label=shaded_reference_label, 
                        vlines=vlines, vline_colors=vline_colors, vline_styles=vline_styles, vline_labels=vline_labels, 
                        ylim=ylim, xlim=xlim, legend=legend, title=title, side_title=side_title, plot_percentages=plot_percentages)

        if(show):
            pyplot.show()

        return fig, ax
//  [python]
ax.set(xscale="log", yscale="log")
sns.regplot("n", "t",df , ax=ax, 
            scatter_kws={"s": 40,'edgecolors':'k','linewidths':1})
plt.ylabel("Time ($\mu$s)")
plt.xlabel("n")
sns.despine()
//  [python]
ax.set(xscale="log", yscale="log")
sns.regplot("n", "t",df , ax=ax, 
            scatter_kws={"s": 40,'edgecolors':'k','linewidths':1})
plt.ylabel("Time ($\mu$s)")
plt.xlabel("n")
sns.utils.despine()
//  [python]
def figure_basic(self, plot_S='line', plot_E='line', plot_I='line',plot_R='line', plot_F='line',
                        plot_Q_E='line', plot_Q_I='line', combine_D=True,
                        color_S='tab:green', color_E='orange', color_I='crimson', color_R='tab:blue', color_F='black',
                        color_Q_E='mediumorchid', color_Q_I='mediumorchid', color_reference='#E0E0E0',
                        dashed_reference_results=None, dashed_reference_label='reference', 
                        shaded_reference_results=None, shaded_reference_label='reference', 
                        vlines=[], vline_colors=[], vline_styles=[], vline_labels=[],
                        ylim=None, xlim=None, legend=True, title=None, side_title=None, plot_percentages=True,
                        figsize=(12,8), use_seaborn=True, show=True):

        import matplotlib.pyplot as pyplot

        fig, ax = pyplot.subplots(figsize=figsize)

        if(use_seaborn):
            import seaborn
            seaborn.set_style('ticks')
            seaborn.despine()

        self.plot(ax=ax, plot_S=plot_S, plot_E=plot_E, plot_I=plot_I,plot_R=plot_R, plot_F=plot_F,
                        plot_Q_E=plot_Q_E, plot_Q_I=plot_Q_I, combine_D=combine_D,
                        color_S=color_S, color_E=color_E, color_I=color_I, color_R=color_R, color_F=color_F,
                        color_Q_E=color_Q_E, color_Q_I=color_Q_I, color_reference=color_reference,
                        dashed_reference_results=dashed_reference_results, dashed_reference_label=dashed_reference_label, 
                        shaded_reference_results=shaded_reference_results, shaded_reference_label=shaded_reference_label, 
                        vlines=vlines, vline_colors=vline_colors, vline_styles=vline_styles, vline_labels=vline_labels,
                        ylim=ylim, xlim=xlim, legend=legend, title=title, side_title=side_title, plot_percentages=plot_percentages)

        if(show):
            pyplot.show()

        return fig, ax
//  [python]
def figure_basic(self, plot_S='line', plot_E='line', plot_I='line',plot_R='line', plot_F='line',
                        plot_Q_E='line', plot_Q_I='line', combine_D=True,
                        color_S='tab:green', color_E='orange', color_I='crimson', color_R='tab:blue', color_F='black',
                        color_Q_E='mediumorchid', color_Q_I='mediumorchid', color_reference='#E0E0E0',
                        dashed_reference_results=None, dashed_reference_label='reference', 
                        shaded_reference_results=None, shaded_reference_label='reference', 
                        vlines=[], vline_colors=[], vline_styles=[], vline_labels=[],
                        ylim=None, xlim=None, legend=True, title=None, side_title=None, plot_percentages=True,
                        figsize=(12,8), use_seaborn=True, show=True):

        import matplotlib.pyplot as pyplot

        fig, ax = pyplot.subplots(figsize=figsize)

        if(use_seaborn):
            import seaborn
            seaborn.set_style('ticks')
            seaborn.utils.despine()

        self.plot(ax=ax, plot_S=plot_S, plot_E=plot_E, plot_I=plot_I,plot_R=plot_R, plot_F=plot_F,
                        plot_Q_E=plot_Q_E, plot_Q_I=plot_Q_I, combine_D=combine_D,
                        color_S=color_S, color_E=color_E, color_I=color_I, color_R=color_R, color_F=color_F,
                        color_Q_E=color_Q_E, color_Q_I=color_Q_I, color_reference=color_reference,
                        dashed_reference_results=dashed_reference_results, dashed_reference_label=dashed_reference_label, 
                        shaded_reference_results=shaded_reference_results, shaded_reference_label=shaded_reference_label, 
                        vlines=vlines, vline_colors=vline_colors, vline_styles=vline_styles, vline_labels=vline_labels,
                        ylim=ylim, xlim=xlim, legend=legend, title=title, side_title=side_title, plot_percentages=plot_percentages)

        if(show):
            pyplot.show()

        return fig, ax
//  [python]
def figure_infections(self, plot_S=False, plot_E='stacked', plot_I='stacked',plot_R=False, plot_F=False,
                            plot_Q_E='stacked', plot_Q_I='stacked', combine_D=True,
                            color_S='tab:green', color_E='orange', color_I='crimson', color_R='tab:blue', color_F='black',
                            color_Q_E='mediumorchid', color_Q_I='mediumorchid', color_reference='#E0E0E0',
                            dashed_reference_results=None, dashed_reference_label='reference', 
                            shaded_reference_results=None, shaded_reference_label='reference', 
                            vlines=[], vline_colors=[], vline_styles=[], vline_labels=[],
                            ylim=None, xlim=None, legend=True, title=None, side_title=None, plot_percentages=True,
                            figsize=(12,8), use_seaborn=True, show=True):

        import matplotlib.pyplot as pyplot

        fig, ax = pyplot.subplots(figsize=figsize)

        if(use_seaborn):
            import seaborn
            seaborn.set_style('ticks')
            seaborn.despine()

        self.plot(ax=ax, plot_S=plot_S, plot_E=plot_E, plot_I=plot_I,plot_R=plot_R, plot_F=plot_F,
                        plot_Q_E=plot_Q_E, plot_Q_I=plot_Q_I, combine_D=combine_D,
                        color_S=color_S, color_E=color_E, color_I=color_I, color_R=color_R, color_F=color_F,
                        color_Q_E=color_Q_E, color_Q_I=color_Q_I, color_reference=color_reference,
                        dashed_reference_results=dashed_reference_results, dashed_reference_label=dashed_reference_label, 
                        shaded_reference_results=shaded_reference_results, shaded_reference_label=shaded_reference_label, 
                        vlines=vlines, vline_colors=vline_colors, vline_styles=vline_styles, vline_labels=vline_labels, 
                        ylim=ylim, xlim=xlim, legend=legend, title=title, side_title=side_title, plot_percentages=plot_percentages)

        if(show):
            pyplot.show()

        return fig, ax
//  [python]
def figure_infections(self, plot_S=False, plot_E='stacked', plot_I='stacked',plot_R=False, plot_F=False,
                            plot_Q_E='stacked', plot_Q_I='stacked', combine_D=True,
                            color_S='tab:green', color_E='orange', color_I='crimson', color_R='tab:blue', color_F='black',
                            color_Q_E='mediumorchid', color_Q_I='mediumorchid', color_reference='#E0E0E0',
                            dashed_reference_results=None, dashed_reference_label='reference', 
                            shaded_reference_results=None, shaded_reference_label='reference', 
                            vlines=[], vline_colors=[], vline_styles=[], vline_labels=[],
                            ylim=None, xlim=None, legend=True, title=None, side_title=None, plot_percentages=True,
                            figsize=(12,8), use_seaborn=True, show=True):

        import matplotlib.pyplot as pyplot

        fig, ax = pyplot.subplots(figsize=figsize)

        if(use_seaborn):
            import seaborn
            seaborn.set_style('ticks')
            seaborn.utils.despine()

        self.plot(ax=ax, plot_S=plot_S, plot_E=plot_E, plot_I=plot_I,plot_R=plot_R, plot_F=plot_F,
                        plot_Q_E=plot_Q_E, plot_Q_I=plot_Q_I, combine_D=combine_D,
                        color_S=color_S, color_E=color_E, color_I=color_I, color_R=color_R, color_F=color_F,
                        color_Q_E=color_Q_E, color_Q_I=color_Q_I, color_reference=color_reference,
                        dashed_reference_results=dashed_reference_results, dashed_reference_label=dashed_reference_label, 
                        shaded_reference_results=shaded_reference_results, shaded_reference_label=shaded_reference_label, 
                        vlines=vlines, vline_colors=vline_colors, vline_styles=vline_styles, vline_labels=vline_labels, 
                        ylim=ylim, xlim=xlim, legend=legend, title=title, side_title=side_title, plot_percentages=plot_percentages)

        if(show):
            pyplot.show()

        return fig, ax
//  [python]
def plot(outf):
    csvf = outf + ".csv"
    df = pandas.read_csv(csvf)
    df = df.set_index("benchmark")
    print(df)

    # ugly patching for cuttin off bars too high
    height_limit = 3250
    # height_limit = 12000

    sns.set(style="darkgrid", palette="deep")
    ax = df.plot.bar(rot=30, figsize=(32, 10), ylim=(1,height_limit*1.1))
    ax.set_ylabel("Runtime (seconds)")
    for x in ax.get_xticklabels() + ax.legend().get_texts() + ax.get_yticklabels() + [ax.title, ax.xaxis.label, ax.yaxis.label]:
        x.set_fontsize(14)
    sns.despine()
    # ax.set_title("SPEC CPU 2017 benchmark results\nCompile flags used: -fno-unsafe-math-optimizations -fno-tree-loop-vectorize -O3")

    for p in ax.patches:
        if p.get_height() < height_limit*0.96: continue
        ax.annotate("("+format(p.get_height(), '.0f')+")",
            (p.get_x() + p.get_width() / 2., min(height_limit, p.get_height())), 
            ha = 'center', va = 'center', 
            xytext = (0, 9), 
            textcoords = 'offset points')
    for p in ax.patches:
        if p.get_height() > height_limit:
            p.set_height(height_limit)

    plot = outf + ".pdf"

    fig = ax.get_figure()
    fig.savefig(plot)
//  [python]
def plot(outf):
    csvf = outf + ".csv"
    df = pandas.read_csv(csvf)
    df = df.set_index("benchmark")
    print(df)

    # ugly patching for cuttin off bars too high
    height_limit = 3250
    # height_limit = 12000

    sns.set(style="darkgrid", palette="deep")
    ax = df.plot.bar(rot=30, figsize=(32, 10), ylim=(1,height_limit*1.1))
    ax.set_ylabel("Runtime (seconds)")
    for x in ax.get_xticklabels() + ax.legend().get_texts() + ax.get_yticklabels() + [ax.title, ax.xaxis.label, ax.yaxis.label]:
        x.set_fontsize(14)
    sns.utils.despine()
    # ax.set_title("SPEC CPU 2017 benchmark results\nCompile flags used: -fno-unsafe-math-optimizations -fno-tree-loop-vectorize -O3")

    for p in ax.patches:
        if p.get_height() < height_limit*0.96: continue
        ax.annotate("("+format(p.get_height(), '.0f')+")",
            (p.get_x() + p.get_width() / 2., min(height_limit, p.get_height())), 
            ha = 'center', va = 'center', 
            xytext = (0, 9), 
            textcoords = 'offset points')
    for p in ax.patches:
        if p.get_height() > height_limit:
            p.set_height(height_limit)

    plot = outf + ".pdf"

    fig = ax.get_figure()
    fig.savefig(plot)
//  [python]
def gen_plot_ADD(thres, column):
    y_label = 'CNN_ADD_prob'
    df = pd.read_csv('../NeuroPathTable/ALL.csv')
    index_names = df[df['diff_days'] > thres * 365].index
    df.drop(index_names, inplace = True)
    index_names = df[df['Group'] == 'NC'].index
    df.drop(index_names, inplace=True)
    index_names = df[df['Group'] == 'MCI'].index
    df.drop(index_names, inplace=True)

    df['ADD rank'] = df[y_label].rank()
    y_label = 'ADD rank'

    ax = sns.boxplot(x=column, y=y_label, data=df, color='white', linewidth=2.5)
    for i, box in enumerate(ax.artists):
        box.set_edgecolor(palette[i])
        box.set_alpha(0.3)
        for j in range(i * 6, i * 6 + 6):
            line = ax.lines[j]
            line.set_color(palette[i])
            line.set_mfc(palette[i])
            line.set_mec(palette[i])
            line.set_alpha(0.3)
    ax = sns.swarmplot(x=column, y=y_label, data=df, palette=palette,
                       marker=open_circle, size=6)
    sns.despine()

    ax.set_xlabel(column.replace('_', ' '), fontsize=15, fontweight='bold')
    ax.set_ylabel(y_label, fontsize=15, fontweight='bold')
    plt.savefig("boxplot/{}years_".format(thres) + column + '__' + y_label + ".png", bbox_inches='tight')
    plt.close()
//  [python]
def gen_plot_ADD(thres, column):
    y_label = 'CNN_ADD_prob'
    df = pd.read_csv('../NeuroPathTable/ALL.csv')
    index_names = df[df['diff_days'] > thres * 365].index
    df.drop(index_names, inplace = True)
    index_names = df[df['Group'] == 'NC'].index
    df.drop(index_names, inplace=True)
    index_names = df[df['Group'] == 'MCI'].index
    df.drop(index_names, inplace=True)

    df['ADD rank'] = df[y_label].rank()
    y_label = 'ADD rank'

    ax = sns.boxplot(x=column, y=y_label, data=df, color='white', linewidth=2.5)
    for i, box in enumerate(ax.artists):
        box.set_edgecolor(palette[i])
        box.set_alpha(0.3)
        for j in range(i * 6, i * 6 + 6):
            line = ax.lines[j]
            line.set_color(palette[i])
            line.set_mfc(palette[i])
            line.set_mec(palette[i])
            line.set_alpha(0.3)
    ax = sns.swarmplot(x=column, y=y_label, data=df, palette=palette,
                       marker=open_circle, size=6)
    sns.utils.despine()

    ax.set_xlabel(column.replace('_', ' '), fontsize=15, fontweight='bold')
    ax.set_ylabel(y_label, fontsize=15, fontweight='bold')
    plt.savefig("boxplot/{}years_".format(thres) + column + '__' + y_label + ".png", bbox_inches='tight')
    plt.close()
//  [python]
def pop_percentage(
    adata: AnnData,
    groupby: Union[str, List[str], None] = None,
    key: str = "scyan_pop",
    figsize: tuple[float, float] = None,
    dendogram: bool = False,
    show: bool = True,
):
    """Show populations percentages. Depending on `groupby`, this is either done globally, or as a stacked bar plot (one bar for each group).

    Args:
        adata: An `AnnData` object.
        groupby: Key(s) of `adata.obs` used to create groups (e.g. the patient ID).
        key: Key of `adata.obs` containing the population names (or the values) for which percentage will be displayed.
        figsize: matplotlib figure size.
        dendogram: If True, the groups are sorted based on a dendogram clustering.
        show: Whether or not to display the figure.
    """
    if groupby is None:
        adata.obs[key].value_counts(normalize=True).mul(100).plot.bar(figsize=figsize)
    else:
        df = adata.obs.groupby(groupby)[key].value_counts(normalize=True)
        df = df.mul(100).unstack()

        if dendogram:
            Z = hierarchy.linkage(df.values, method="ward")
            dendrogram = hierarchy.dendrogram(Z, no_plot=True)
            df = df.iloc[dendrogram["leaves"]]

        df.plot.bar(stacked=True, figsize=figsize)
        plt.legend(
            bbox_to_anchor=(1.04, 0.5), loc="center left", borderaxespad=0, frameon=False
        )

    plt.ylabel(f"{key} percentage")
    sns.despine(offset=10, trim=True)
    plt.xticks(rotation=90)
//  [python]
def pop_percentage(
    adata: AnnData,
    groupby: Union[str, List[str], None] = None,
    key: str = "scyan_pop",
    figsize: tuple[float, float] = None,
    dendogram: bool = False,
    show: bool = True,
):
    """Show populations percentages. Depending on `groupby`, this is either done globally, or as a stacked bar plot (one bar for each group).

    Args:
        adata: An `AnnData` object.
        groupby: Key(s) of `adata.obs` used to create groups (e.g. the patient ID).
        key: Key of `adata.obs` containing the population names (or the values) for which percentage will be displayed.
        figsize: matplotlib figure size.
        dendogram: If True, the groups are sorted based on a dendogram clustering.
        show: Whether or not to display the figure.
    """
    if groupby is None:
        adata.obs[key].value_counts(normalize=True).mul(100).plot.bar(figsize=figsize)
    else:
        df = adata.obs.groupby(groupby)[key].value_counts(normalize=True)
        df = df.mul(100).unstack()

        if dendogram:
            Z = hierarchy.linkage(df.values, method="ward")
            dendrogram = hierarchy.dendrogram(Z, no_plot=True)
            df = df.iloc[dendrogram["leaves"]]

        df.plot.bar(stacked=True, figsize=figsize)
        plt.legend(
            bbox_to_anchor=(1.04, 0.5), loc="center left", borderaxespad=0, frameon=False
        )

    plt.ylabel(f"{key} percentage")
    sns.utils.despine(offset=10, trim=True)
    plt.xticks(rotation=90)
//  [python]
def figure_basic(self,  plot_S='line', plot_E='line', plot_I_pre='line', plot_I_sym='line', plot_I_asym='line',
                            plot_H='line', plot_R='line', plot_F='line',
                            plot_Q_E='line', plot_Q_pre='line', plot_Q_sym='line', plot_Q_asym='line', 
                            plot_Q_S=False, plot_Q_R=False, combine_Q_infected=True,
                            color_S='tab:green', color_E='orange', color_I_pre='tomato', color_I_sym='crimson', color_I_asym='#F0909B', 
                            color_H='violet', color_R='tab:blue', color_F='black',
                            color_Q_E='orange', color_Q_pre='tomato', color_Q_sym='crimson', color_Q_asym='#F0909B', 
                            color_Q_S='tab:green',  color_Q_R='tab:blue', color_Q_infected='tab:purple',
                            color_reference='#E0E0E0',
                            dashed_reference_results=None, dashed_reference_label='reference', 
                            shaded_reference_results=None, shaded_reference_label='reference', 
                            vlines=[], vline_colors=[], vline_styles=[], vline_labels=[],
                            ylim=None, xlim=None, legend=True, title=None, side_title=None, plot_percentages=True,
                            figsize=(12,8), use_seaborn=True, show=True):

        import matplotlib.pyplot as pyplot

        fig, ax = pyplot.subplots(figsize=figsize)

        if(use_seaborn):
            import seaborn
            seaborn.set_style('ticks')
            seaborn.despine()

        self.plot(ax=ax, plot_S=plot_S, plot_E=plot_E, plot_I_pre=plot_I_pre, plot_I_sym=plot_I_sym, plot_I_asym=plot_I_asym,
                        plot_H=plot_H, plot_R=plot_R, plot_F=plot_F,
                        plot_Q_E=plot_Q_E, plot_Q_pre=plot_Q_pre, plot_Q_sym=plot_Q_sym, plot_Q_asym=plot_Q_asym, 
                        plot_Q_S=plot_Q_S, plot_Q_R=plot_Q_R, combine_Q_infected=combine_Q_infected,
                        color_S=color_S, color_E=color_E, color_I_pre=color_I_pre, color_I_sym=color_I_sym, color_I_asym=color_I_asym, 
                        color_H=color_H, color_R=color_R, color_F=color_F,
                        color_Q_E=color_Q_E, color_Q_pre=color_Q_pre, color_Q_sym=color_Q_sym, color_Q_asym=color_Q_asym, 
                        color_Q_S=color_Q_S,  color_Q_R=color_Q_R, color_Q_infected=color_Q_infected,
                        color_reference=color_reference,
                        dashed_reference_results=dashed_reference_results, dashed_reference_label=dashed_reference_label, 
                        shaded_reference_results=shaded_reference_results, shaded_reference_label=shaded_reference_label, 
                        vlines=vlines, vline_colors=vline_colors, vline_styles=vline_styles, vline_labels=vline_labels,
                        ylim=ylim, xlim=xlim, legend=legend, title=title, side_title=side_title, plot_percentages=plot_percentages)

        if(show):
            pyplot.show()

        return fig, ax
//  [python]
def figure_basic(self,  plot_S='line', plot_E='line', plot_I_pre='line', plot_I_sym='line', plot_I_asym='line',
                            plot_H='line', plot_R='line', plot_F='line',
                            plot_Q_E='line', plot_Q_pre='line', plot_Q_sym='line', plot_Q_asym='line', 
                            plot_Q_S=False, plot_Q_R=False, combine_Q_infected=True,
                            color_S='tab:green', color_E='orange', color_I_pre='tomato', color_I_sym='crimson', color_I_asym='#F0909B', 
                            color_H='violet', color_R='tab:blue', color_F='black',
                            color_Q_E='orange', color_Q_pre='tomato', color_Q_sym='crimson', color_Q_asym='#F0909B', 
                            color_Q_S='tab:green',  color_Q_R='tab:blue', color_Q_infected='tab:purple',
                            color_reference='#E0E0E0',
                            dashed_reference_results=None, dashed_reference_label='reference', 
                            shaded_reference_results=None, shaded_reference_label='reference', 
                            vlines=[], vline_colors=[], vline_styles=[], vline_labels=[],
                            ylim=None, xlim=None, legend=True, title=None, side_title=None, plot_percentages=True,
                            figsize=(12,8), use_seaborn=True, show=True):

        import matplotlib.pyplot as pyplot

        fig, ax = pyplot.subplots(figsize=figsize)

        if(use_seaborn):
            import seaborn
            seaborn.set_style('ticks')
            seaborn.utils.despine()

        self.plot(ax=ax, plot_S=plot_S, plot_E=plot_E, plot_I_pre=plot_I_pre, plot_I_sym=plot_I_sym, plot_I_asym=plot_I_asym,
                        plot_H=plot_H, plot_R=plot_R, plot_F=plot_F,
                        plot_Q_E=plot_Q_E, plot_Q_pre=plot_Q_pre, plot_Q_sym=plot_Q_sym, plot_Q_asym=plot_Q_asym, 
                        plot_Q_S=plot_Q_S, plot_Q_R=plot_Q_R, combine_Q_infected=combine_Q_infected,
                        color_S=color_S, color_E=color_E, color_I_pre=color_I_pre, color_I_sym=color_I_sym, color_I_asym=color_I_asym, 
                        color_H=color_H, color_R=color_R, color_F=color_F,
                        color_Q_E=color_Q_E, color_Q_pre=color_Q_pre, color_Q_sym=color_Q_sym, color_Q_asym=color_Q_asym, 
                        color_Q_S=color_Q_S,  color_Q_R=color_Q_R, color_Q_infected=color_Q_infected,
                        color_reference=color_reference,
                        dashed_reference_results=dashed_reference_results, dashed_reference_label=dashed_reference_label, 
                        shaded_reference_results=shaded_reference_results, shaded_reference_label=shaded_reference_label, 
                        vlines=vlines, vline_colors=vline_colors, vline_styles=vline_styles, vline_labels=vline_labels,
                        ylim=ylim, xlim=xlim, legend=legend, title=title, side_title=side_title, plot_percentages=plot_percentages)

        if(show):
            pyplot.show()

        return fig, ax
//  [python]
fig, axes = plt.subplots(1, 1, figsize=[6, 3], sharey=True)
p_test.plot(nbins=10, axes=axes)
plt.title('Pairwise distance - %.2f sec.' % duration)
print('p-value: %.3f' % p)
sns.despine()
//  [python]
fig, axes = plt.subplots(1, 1, figsize=[6, 3], sharey=True)
p_test.plot(nbins=10, axes=axes)
plt.title('Pairwise distance - %.2f sec.' % duration)
print('p-value: %.3f' % p)
sns.utils.despine()