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
handleheight=0.7 / f, handletextpad=0.8 / f, borderaxespad=0.5 / f) mpl.rc('figure', figsize=(17 / 2.54, 5 / 2.54), dpi=300) sim_set_names = [ "kg_vdiv_nodil_nHill_15_KHill_16.pkl", "kg_vdiv_nodil_plain.pkl" ] load_fun = aux.get_load_df_fun("simulation_data/transformed_kg_vdiv_scans") sim_sets = [load_fun(name) for name in sim_set_names] plot_selections = [ "SN_cCln3", "SN_cWhi3P", "SN_cWhi5", "SN_cCln12", "SN_Sbf_ac", "V_tot_fl" ] rates = sim_sets[0].growth_rate fig, big_ax = plt.subplots() aux.clean_big_ax(big_ax) loc_dict = aux.get_inset_loc(2, 1, 0.08, 0) insets = [big_ax.inset_axes(loc_dict[key]) for key in loc_dict] for ax in insets: aux.clean_big_ax(ax) loc_dict1 = aux.get_inset_loc(2, 1, 0.02, 0) t_in = [insets[1].inset_axes(loc_dict1[key]) for key in loc_dict1] v_in = [insets[0].inset_axes(loc_dict1[key]) for key in loc_dict1] cb_ax, kw = mpl.colorbar.make_axes(big_ax, orientation="vertical", fraction=0.05, aspect=20, pad=0.005) desc = "G1 growth rate [fL/min]"
handleheight=0.7 / f, handletextpad=0.8 / f, borderaxespad=0.5 / f) mpl.rc('figure', figsize=(17 / 2.54, 10 / 2.54), dpi=300) mpl.rc('grid', linewidth=0.8 / 2.54) load_fun = aux.get_load_df_fun("simulation_data/transformed_kg_vdiv_scans") 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])
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)