From 512c3824789c4530a64775538806163a84d9c489 Mon Sep 17 00:00:00 2001 From: Andrey Aristov <aaristov@pasteur.fr> Date: Fri, 3 Jun 2022 15:23:50 +0200 Subject: [PATCH] more plots --- merge_tables.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/merge_tables.py b/merge_tables.py index 5176a15..0af2cf2 100644 --- a/merge_tables.py +++ b/merge_tables.py @@ -13,19 +13,32 @@ def combine(table_day1_path, table_day2_path, table_output_path, swarmplot_outpu day1.to_csv(table_output_path, index=None) n_max = int(day1.n_cells.mean() * 3) - plot_swarm(day1, n_max=n_max, path=swarmplot_output_path) + plot_swarm_counts(day1, n_max=n_max, path=swarmplot_output_path) + plot_swarm_intensity(day1, n_max=n_max, path=swarmplot_output_path.replace('.png', '_intensities.png')) plot_probs(day1, n_max=n_max,path=prob_plot_path) + plot_probs_log(day1, n_max=n_max,path=prob_plot_path.replace('.png', '_log.png')) -def plot_swarm(table:pd.DataFrame, n_max:int=5, path=None): +def plot_swarm_counts(table:pd.DataFrame, n_max:int=5, path=None): fig, ax = plt.subplots(dpi=300) sns.swarmplot(ax=ax, data=table.query(f'n_cells < {n_max}'), x='[AB]', y='n_cells_final', hue='n_cells', dodge=True, size=1 ) fig.savefig(path) +def plot_swarm_intensity(table:pd.DataFrame, n_max:int=5, path=None): + fig, ax = plt.subplots(dpi=300) + sns.swarmplot(ax=ax, data=table.query(f'n_cells < {n_max}'), x='[AB]', y='intensity_final', hue='n_cells', dodge=True, size=1 ) + fig.savefig(path) + def plot_probs(table:pd.DataFrame, n_max:int=5, path=None): fig, ax = plt.subplots(dpi=300) sns.lineplot(ax=ax, data=table.query(f'n_cells < {n_max}'), x='[AB]', y='final_state', hue='n_cells') fig.savefig(path) +def plot_probs_log(table:pd.DataFrame, n_max:int=5, path=None): + fig, ax = plt.subplots(dpi=300) + sns.lineplot(ax=ax, data=table.query(f'n_cells < {n_max}'), x='[AB]', y='final_state', hue='n_cells') + ax.set_xscale('log') + fig.savefig(path) + if __name__ == "__main__": fire.Fire(combine) \ No newline at end of file -- GitLab