//  [python]
def plot(lstms2s, transformer, convs2s, source_file_opennmt, target_file_opennmt, \
         source_file_fairseq, target_file_fairseq, \
         output_filename, keep_ylabels=False, mode="depth", inter_task_legend=False):
    x_lstms2s, y_lstms2s = load_results(lstms2s, source_file_opennmt, target_file_opennmt, mode)
    x_transf, y_transf = load_results(transformer, source_file_opennmt, target_file_opennmt, mode)
    x_convs2s, y_convs2s = load_results(convs2s, source_file_fairseq, target_file_fairseq, mode)

    folder = "../task_success/lengths/"
    x_lstms2s_all, y_lstms2s_all = load_results(lstms2s, source_file_opennmt, target_file_opennmt, mode, folder=folder)
    x_transf_all, y_transf_all = load_results(transformer, source_file_opennmt, target_file_opennmt, mode, folder=folder)
    x_convs2s_all, y_convs2s_all = load_results(convs2s, source_file_fairseq, target_file_fairseq, mode, folder=folder)

    # Figure size
    if keep_ylabels:
        sns.set(rc={'figure.figsize':(6,3.5), "lines.linewidth": 3})
    else:
        sns.set(rc={'figure.figsize':(6,3.5), "lines.linewidth": 3})

    blues = list(sns.color_palette("Blues", 10))
    reds = list(sns.color_palette("Reds", 10))
    ax = sns.lineplot(x=x_lstms2s, y=y_lstms2s, color=blues[3], marker=".", label="LSTMS2S" if not inter_task_legend else "", markeredgecolor='none')
    ax = sns.lineplot(x=x_lstms2s_all, y=y_lstms2s_all, color=reds[3], marker=".", markeredgecolor='none', alpha=0.5)
    ax.lines[0].set_linestyle("--")
    ax.lines[1].set_linestyle("--")
    ax = sns.lineplot(x=x_convs2s, y=y_convs2s, color=blues[6], marker=".", ax=ax, label="ConvS2S" if not inter_task_legend else "Productivity", markeredgecolor='none')
    ax = sns.lineplot(x=x_convs2s_all, y=y_convs2s_all, color=reds[6], marker=".", ax=ax, label="" if not inter_task_legend else "Task Success", markeredgecolor='none', alpha=0.5)
    ax.lines[2].set_linestyle(":")
    ax.lines[3].set_linestyle(":")
    ax = sns.lineplot(x=x_transf, y=y_transf, color=blues[9], marker=".", ax=ax, label="Transformer" if not inter_task_legend else "", markeredgecolor='none')
    ax = sns.lineplot(x=x_transf_all, y=y_transf_all, color=reds[9], marker=".", ax=ax, markeredgecolor='none', alpha=0.5)

    if mode == "depth":
        plt.xlim(min(x_lstms2s), 14)
        plt.xticks(list(range(min(x_lstms2s), 14 + 1, 1)))
    elif mode == "functions":
        plt.xlim(min(x_lstms2s), 15)
        plt.xticks(list(range(min(x_lstms2s), 15 + 1, 1)))
    else:
        plt.xticks(list(range(min(x_lstms2s) + 1, 50 + 1, 5)))
        plt.xlim(min(x_lstms2s), 50)
    plt.ylim(-0.01, 1.01)

    # Share axes for subplots displayed next to each other in the paper, but keep grid
    ax.grid(True)
    ax.set_xlabel(mode, fontsize=20)
    ax.tick_params(labelsize=20)
    if keep_ylabels:
        plt.yticks(list([x / 10 for x in range(0,12, 2)]))
        ax.set_ylabel("accuracy", fontsize=20)
        plt.legend(fontsize=15)
    elif inter_task_legend:
        plt.yticks(list([x / 10 for x in range(0,12, 2)]))
        ax.yaxis.set_ticklabels([])
        plt.legend(fontsize=15)
    else:
        plt.yticks(list([x / 10 for x in range(0,12, 2)]))
        ax.yaxis.set_ticklabels([])
        ax.get_legend().set_visible(False)

    ax.tick_params(labelsize=20)
    plt.savefig(output_filename, bbox_inches='tight')
    #plt.show()
    plt.clf()