From 26ee826884cc1f49765d1f870763dca16c7620fb Mon Sep 17 00:00:00 2001 From: Henry Date: Tue, 26 Mar 2024 16:23:04 +0100 Subject: [PATCH] :art: assign same colors as in njab - indicate with colors core of comparison (100%, no imputation is ground truth) --- project/10_7_ald_reduced_dataset_plots.ipynb | 12 ++++++++++-- project/10_7_ald_reduced_dataset_plots.py | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/project/10_7_ald_reduced_dataset_plots.ipynb b/project/10_7_ald_reduced_dataset_plots.ipynb index b27ea2db4..748c82944 100644 --- a/project/10_7_ald_reduced_dataset_plots.ipynb +++ b/project/10_7_ald_reduced_dataset_plots.ipynb @@ -38,6 +38,10 @@ "COLORS_TO_USE_MAPPTING = vaep.plotting.defaults.color_model_mapping\n", "COLORS_TO_USE_MAPPTING[NONE_COL_NAME] = COLORS_TO_USE_MAPPTING['None']\n", "\n", + "COLORS_CONTIGENCY_TABLE = {\n", + " k: f'C{i}' for i, k in enumerate(['FP', 'TN', 'TP', 'FN'])\n", + "}\n", + "\n", "\n", "def plot_qvalues(df, x: str, y: list, ax=None, cutoff=0.05,\n", " alpha=1.0, style='.', markersize=3):\n", @@ -242,7 +246,9 @@ ").droplevel(-1, axis=1)\n", ")\n", "da_target_sel_counts = njab.pandas.combine_value_counts(da_target_sel_counts)\n", - "ax = da_target_sel_counts.T.plot.bar(ylabel='count')\n", + "ax = da_target_sel_counts.T.plot.bar(ylabel='count',\n", + " color=[COLORS_CONTIGENCY_TABLE['FN'],\n", + " COLORS_CONTIGENCY_TABLE['TP']])\n", "ax.locator_params(axis='y', integer=True)\n", "fname = out_folder / 'lost_signal_da_counts.pdf'\n", "files_out[fname.name] = fname.as_posix()\n", @@ -313,7 +319,9 @@ ").droplevel(-1, axis=1)\n", ")\n", "da_target_sel_counts = njab.pandas.combine_value_counts(da_target_sel_counts)\n", - "ax = da_target_sel_counts.T.plot.bar(ylabel='count')\n", + "ax = da_target_sel_counts.T.plot.bar(ylabel='count',\n", + " color=[COLORS_CONTIGENCY_TABLE['TN'],\n", + " COLORS_CONTIGENCY_TABLE['FP']])\n", "ax.locator_params(axis='y', integer=True)\n", "fname = out_folder / 'gained_signal_da_counts.pdf'\n", "files_out[fname.name] = fname.as_posix()\n", diff --git a/project/10_7_ald_reduced_dataset_plots.py b/project/10_7_ald_reduced_dataset_plots.py index 1169daa3b..05210636e 100644 --- a/project/10_7_ald_reduced_dataset_plots.py +++ b/project/10_7_ald_reduced_dataset_plots.py @@ -25,6 +25,10 @@ COLORS_TO_USE_MAPPTING = vaep.plotting.defaults.color_model_mapping COLORS_TO_USE_MAPPTING[NONE_COL_NAME] = COLORS_TO_USE_MAPPTING['None'] +COLORS_CONTIGENCY_TABLE = { + k: f'C{i}' for i, k in enumerate(['FP', 'TN', 'TP', 'FN']) +} + def plot_qvalues(df, x: str, y: list, ax=None, cutoff=0.05, alpha=1.0, style='.', markersize=3): @@ -127,7 +131,9 @@ def plot_qvalues(df, x: str, y: list, ax=None, cutoff=0.05, ).droplevel(-1, axis=1) ) da_target_sel_counts = njab.pandas.combine_value_counts(da_target_sel_counts) -ax = da_target_sel_counts.T.plot.bar(ylabel='count') +ax = da_target_sel_counts.T.plot.bar(ylabel='count', + color=[COLORS_CONTIGENCY_TABLE['FN'], + COLORS_CONTIGENCY_TABLE['TP']]) ax.locator_params(axis='y', integer=True) fname = out_folder / 'lost_signal_da_counts.pdf' files_out[fname.name] = fname.as_posix() @@ -171,7 +177,9 @@ def plot_qvalues(df, x: str, y: list, ax=None, cutoff=0.05, ).droplevel(-1, axis=1) ) da_target_sel_counts = njab.pandas.combine_value_counts(da_target_sel_counts) -ax = da_target_sel_counts.T.plot.bar(ylabel='count') +ax = da_target_sel_counts.T.plot.bar(ylabel='count', + color=[COLORS_CONTIGENCY_TABLE['TN'], + COLORS_CONTIGENCY_TABLE['FP']]) ax.locator_params(axis='y', integer=True) fname = out_folder / 'gained_signal_da_counts.pdf' files_out[fname.name] = fname.as_posix()