diff --git a/src/find_interaction_cluster/community_figures/fig_functions.py b/src/find_interaction_cluster/community_figures/fig_functions.py index dc755a6507671337b803d5a293dcbd144615fcb1..124bf0db76fd59256cf69caf18cfedf6d497548b 100644 --- a/src/find_interaction_cluster/community_figures/fig_functions.py +++ b/src/find_interaction_cluster/community_figures/fig_functions.py @@ -329,9 +329,13 @@ def make_barplot(df_bar: pd.DataFrame, outfile: Path, :param feature: The king of feature of interest """ sns.set(context="poster") - g = sns.catplot(x="community", y=target_col, data=df_bar, kind="bar", - ci="sd", aspect=2.5, height=12, errwidth=0.5, capsize=.4, + g = sns.catplot(x="community", y=target_col, data=df_bar, kind="point", + ci="sd", aspect=2.5, height=14, errwidth=0.5, capsize=.4, + scale=0.5, palette=["red"] + ["darkgray"] * (df_bar.shape[0] - 1)) + g2 = sns.catplot(x="community", y=target_col, data=df_bar, kind="bar", + ci="sd", aspect=2.5, height=14, errwidth=0.5, capsize=.4, + palette=["red"] + ["darkgray"] * (df_bar.shape[0] - 1)) g.fig.subplots_adjust(top=0.9) target_kind = f" ({target_kind})" if target_kind else "" g.fig.suptitle(f"Mean frequency of {target_col}{target_kind}" @@ -340,7 +344,7 @@ def make_barplot(df_bar: pd.DataFrame, outfile: Path, g.set(xticklabels=[]) g.ax.set_ylabel(f'Frequency of {target_col}') df_bara = df_bar.drop_duplicates(subset="community", keep="first") - for i, p in enumerate(g.ax.patches): + for i, p in enumerate(g2.ax.patches): stats = "*" if df_bara.iloc[i, :]["p-adj"] < 0.05 else "" com = df_bara.iloc[i, :]["community"] csd = np.std(df_bar.loc[df_bar["community"] == com, target_col])