Skip to content

Commit

Permalink
Update multicountry relative outputs figure
Browse files Browse the repository at this point in the history
  • Loading branch information
romain-ragonnet committed Nov 20, 2023
1 parent 06486d4 commit c9ae547
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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))

Expand Down Expand Up @@ -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("<br>", " ")
axis.set_ylabel(y_label, fontsize=15)
axis.set_ylabel(y_label, fontsize=18)

# add coloured backgorund patches
xmin, xmax = axis.get_xlim()
Expand All @@ -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()

Expand Down
15 changes: 7 additions & 8 deletions user/rragonnet/remote_run_outputs/file_gatherer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -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"
]
},
{
Expand All @@ -37,7 +36,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -117,7 +116,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -142,7 +141,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
Expand Down

0 comments on commit c9ae547

Please sign in to comment.