def get_row_big_axes(big_ax):
    gs = aux.loc(nrows=3,
                 ncols=1,
                 hs=0,
                 vs=0.05,
                 height_ratios=[1 / 3, 1 / 3, 1 / 3])
    print(gs.shape)
    row_big_axes = [big_ax.inset_axes(gs[i, 0]) for i in range(gs.shape[0])]
    for ax in row_big_axes:
        aux.clean_big_ax(ax)
    return row_big_axes
           handlelength=2 / f,
           handleheight=0.7 / f,
           handletextpad=0.8 / f,
           borderaxespad=0.5 / f)
    mpl.rc('figure', figsize=(17 / 2.54, 8 / 2.54), dpi=300)

    names = [1, 10, 100]
    full_names = ["n_hill_" + str(name) + ".pkl" for name in names]

    scans = [aux.load_set(name) for name in full_names]

    fig, big_ax = plt.subplots()
    aux.clean_big_ax(big_ax)
    gs = aux.loc(nrows=2,
                 ncols=3,
                 hs=0.013,
                 vs=0.02,
                 width_ratios=(1 / 3, 1 / 3, 1 / 3),
                 height_ratios=(1 / 2, 1 / 2))
    row_axes = [[big_ax.inset_axes(gs[k, i]) for i in range(gs.shape[1])]
                for k in range(gs.shape[0])]
    labels = ["SN_cCln3", "SN_cWhi3P"]

    for axes, label in zip(row_axes, labels):
        for ax, scan in zip(axes, scans):
            plot_quant(ax, label, scan)

    vols = get_param_vals(scans)
    cb_ax, kw = mpl.colorbar.make_axes(big_ax,
                                       fraction=0.15,
                                       aspect=20,
                                       pad=0.02)
Example #3
0
    sim_set_names = ["kg_vdiv_nHill_10.pkl", "kg_vdiv_kpCln3_003.pkl"]
    sim_sets = [load_fun(name) for name in sim_set_names]

    rates = sim_sets[0].growth_rate
    fig = plt.figure()

    gs = fig.add_gridspec(ncols=2, nrows=1, width_ratios=[0.64, 0.36])
    big_ax, small_ax = fig.add_subplot(gs[0]), fig.add_subplot(gs[1])
    fig.subplots_adjust(wspace=0.3)
    aux.clean_big_ax(big_ax)
    aux.clean_big_ax(small_ax)
    nx = 0.03
    ny = 0.02
    gs1 = aux.loc(2,
                  2,
                  nx,
                  ny,
                  height_ratios=[1 / 2, 1 / 2],
                  width_ratios=[1 / 2, 1 / 2])
    tg1_axes, vstart_axes = [[
        big_ax.inset_axes(gs1[k, i]) for i in range(gs1.shape[1])
    ] for k in range(gs1.shape[0])]

    gs2 = aux.loc(2, 1, nx, ny, height_ratios=[1 / 2, 1 / 2])

    desc = "G1 growth rate [fL/min]"

    for i, sim_set in enumerate(sim_sets):
        plot_vdiv_y_multi(sim_set, "v_trans", vstart_axes[i])
        plot_vdiv_y_multi(sim_set, "t_g1", tg1_axes[i])

    cmap = mpl.pyplot.cm.coolwarm
Example #4
0
    mpl.rc('xtick.major', size=3.5 / f, width=0.8 / f, pad=0.8 / f)
    mpl.rc('ytick.major', size=3.5 / f, width=0.8 / f, pad=0.8 / f)
    mpl.rc('ytick', labelsize=8)
    mpl.rc('legend', frameon=False, fontsize=8, borderpad=0.4 / f, labelspacing=0.5 / f, handlelength=2 / f,
           handleheight=0.7 / f, handletextpad=0.8 / f, borderaxespad=0.5 / f)
    mpl.rc('figure', figsize=(17 / 2.54, 5 / 2.54), dpi=300)
    names = [["Cln3_V_15", "Cln3_V_30", "Cln3_V_45"],
             ["V_Cln3_0", "V_Cln3_0.5", "V_Cln3_1"],
             ["V_fac_1", "V_fac_10", "V_fac_100"]
             ]

    fig, big_ax = plt.subplots()
    aux.clean_big_ax(big_ax)
    dset_list = [[load_data(n) for n in name] for name in names]
    n = 16
    big_gs = aux.loc(2, 1, 0, 0.1, height_ratios=[(n - 1) / n, 1 / n])
    small_gs = aux.loc(1, 3, 0.02, 0, width_ratios=[1 / 3, 1 / 3, 1 / 3])
    two_axes = [big_ax.inset_axes(big_gs[i, 0]) for i in range(big_gs.shape[0])]
    d_axes, cb_axes = [[two_ax.inset_axes(small_gs[0, i]) for i in range(small_gs.shape[1])] for two_ax in two_axes]
    for ax in two_axes:
        aux.clean_big_ax(ax)

    labels = ["volume [fL]", "Cln3 [a.u./fL]", "Cln12 prod. factor"]
    unit_dict = {"Cln3": "Cln3 [a.u./fL]", "V": "volume [fL]"}
    limits = [(-0.05, 2.5), (-1.5, 61.5), (-1.5, 61.5)]
    for dset, d_ax, cb_ax, label, limit in zip(dset_list, d_axes, cb_axes, labels, limits):
        scan_vals = []
        cmap = plt.cm.coolwarm

        for i, data_dict in enumerate(dset):
            color = aux.get_color(cmap, i, len(dset))
def plot_supp(names: list, texts: list, titles: list, figname: str):
    fnames = [[get_full_names(n) for n in names] for names in (names)]
    load_fun = aux.get_load_df_fun("simulation_data/transformed_kg_vdiv_scans")
    dsets_lists = [[load_fun(n) for n in names] for names in fnames]

    fig, big_ax = plt.subplots()
    aux.clean_big_ax(big_ax)
    row_big_axes = get_row_big_axes(big_ax)

    gs = aux.loc(3,
                 3,
                 0.02,
                 0.05,
                 width_ratios=[1 / 3, 1 / 3, 1 / 3],
                 height_ratios=[1 / 3, 1 / 3, 1 / 3])

    row_axes_lists = [get_row_axes(big_ax, gs, i) for i in range(gs.shape[0])]

    for dsets, row_axes in zip(dsets_lists, row_axes_lists):
        for dset, row_ax in zip(dsets, row_axes):
            plot_vdiv_y_multi(dset, "v_trans", row_ax)
    for i, axes in enumerate(row_axes_lists):
        for k, ax in enumerate(axes):
            if i != 0:
                ax.set_xlabel(None)
                ax.set_xticklabels([])
            if k != 0:
                ax.set_ylabel(None)
                ax.set_yticklabels([])
            ax.set_xticks([10, 20, 30, 40, 50])
            ax.set_xlim(9, 51)
            aux.make_grid(ax)

    for ax, title, let in zip(row_big_axes, titles, ["c", "b", "a"]):
        ax.set_title(title)
        ax.text(-0.07,
                1.02,
                "({})".format(let),
                transform=ax.transAxes,
                fontsize=12)

    rates = dsets_lists[0][0].growth_rate
    cb_ax, kw = mpl.colorbar.make_axes(big_ax,
                                       fraction=0.1,
                                       aspect=40,
                                       pad=0.01)
    cb = aux.make_cb(cb_ax,
                     values=rates,
                     cmap=plt.cm.coolwarm,
                     orientation="vertical")
    cb.ax.set_yticklabels(rates)
    cb.set_label("G1 growth rate [fL/min]")

    for text_list, axes in zip(texts, row_axes_lists):
        for text, ax in zip(text_list, axes):
            ax.text(0.98,
                    0.02,
                    text,
                    ha="right",
                    va="bottom",
                    transform=ax.transAxes,
                    fontsize=8)