From c9ae54731b5c86cb67a51d0db5b87cba8d66fa3b Mon Sep 17 00:00:00 2001 From: Romain Ragonnet Date: Mon, 20 Nov 2023 15:47:12 +1100 Subject: [PATCH] Update multicountry relative outputs figure --- .../output_plots/multicountry.py | 22 +++++++++++++------ .../remote_run_outputs/file_gatherer.ipynb | 15 ++++++------- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/autumn/projects/sm_covid2/common_school/output_plots/multicountry.py b/autumn/projects/sm_covid2/common_school/output_plots/multicountry.py index a3fb9188a..89c799f5a 100644 --- a/autumn/projects/sm_covid2/common_school/output_plots/multicountry.py +++ b/autumn/projects/sm_covid2/common_school/output_plots/multicountry.py @@ -16,9 +16,9 @@ } BOX_COLORS= { - "cases_averted_relative": "black", - "deaths_averted_relative": "purple", - "delta_hospital_peak_relative": "firebrick" + "cases_averted_relative": "steelblue", # "black", + "deaths_averted_relative": "mediumseagreen", # "purple", + "delta_hospital_peak_relative": "tomato", # "firebrick" } ANALYSIS_COLORS = { @@ -33,6 +33,9 @@ } def plot_multic_relative_outputs(output_dfs_dict: dict[str, pd.DataFrame], req_outputs=["cases_averted_relative", "deaths_averted_relative", "delta_hospital_peak_relative"]): + + plt.rcParams["font.family"] = "Times New Roman" + n_subplots = len(req_outputs) fig, axes = plt.subplots(n_subplots, 1, figsize=(25, n_subplots*6)) @@ -75,10 +78,10 @@ def plot_multic_relative_outputs(output_dfs_dict: dict[str, pd.DataFrame], req_o axis.set_xlim((0, n_countries + 1)) axis.set_ylim(-1.2*y_max_abs, 1.2*y_max_abs) - axis.set_xticks(ticks=range(1, n_countries + 1), labels=sorted_iso3_list, rotation=90, fontsize=13) + axis.set_xticks(ticks=range(1, n_countries + 1), labels=sorted_iso3_list, rotation=90, fontsize=16) y_label = YLAB_LOOKUP_SPLIT[output].replace("
", " ") - axis.set_ylabel(y_label, fontsize=15) + axis.set_ylabel(y_label, fontsize=18) # add coloured backgorund patches xmin, xmax = axis.get_xlim() @@ -88,8 +91,13 @@ def plot_multic_relative_outputs(output_dfs_dict: dict[str, pd.DataFrame], req_o rect_low = Rectangle(xy=(xmin, ymin), width=xmax - xmin, height=(ymax - ymin)/2., zorder=-1, facecolor="gainsboro", alpha=.5) #"mistyrose") axis.add_patch(rect_low) - axis.text(n_countries * .75, ymax / 2., s="Positive effect of\nschool closures", fontsize=13) - axis.text(n_countries * .25, ymin / 2., s="Negative effect of\nschool closures", fontsize=13) + axis.text(n_countries * .75, ymax / 2., s="Positive effect of\nschool closures", fontsize=18) + axis.text(n_countries * .25, ymin / 2., s="Negative effect of\nschool closures", fontsize=18) + + axis.tick_params(axis='y', labelsize=16) + + panel = ["A", "B", "C"][i_output] + axis.text(-0.04, 1.07, panel, transform=axis.transAxes, fontsize=25, va='top', ha='right') plt.tight_layout() diff --git a/user/rragonnet/remote_run_outputs/file_gatherer.ipynb b/user/rragonnet/remote_run_outputs/file_gatherer.ipynb index c756e5a48..dad67d91c 100644 --- a/user/rragonnet/remote_run_outputs/file_gatherer.ipynb +++ b/user/rragonnet/remote_run_outputs/file_gatherer.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 9, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -18,14 +18,13 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ - "# analysis_folder = Path.cwd() / \"31747883_full_analysis_26Sep2023_main\"\n", + "analysis_folder = Path.cwd() / \"31747883_full_analysis_26Sep2023_main\"\n", "# analysis_folder = Path.cwd() /\"31902886_full_analysis_05Oct2023_increased_hh_contacts\"\n", - "\n", - "analysis_folder = Path.cwd() /\"31915437_full_analysis_05Oct2023_no_google_mobility\"\n" + "# analysis_folder = Path.cwd() /\"31915437_full_analysis_05Oct2023_no_google_mobility\"\n" ] }, { @@ -37,7 +36,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -117,7 +116,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -142,7 +141,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": null, "metadata": {}, "outputs": [], "source": [