degroup cumulative plots by age

This commit is contained in:
rmanach 2021-12-29 11:30:10 +01:00
parent fae3ca91ae
commit 4c41b44d77
2 changed files with 15 additions and 13 deletions

View File

@ -386,24 +386,24 @@ def plot_bar_age_percent_by_field(
def plot_cumulative_field(
np_data: np.ndarray, np_date: np.ndarray, field: Field
) -> None:
fig, _ = get_plot_fig()
np_data_vac, np_data_unvac = split_by_vac_status(np_data)
for age_group in AgeGroup:
fig, _ = get_plot_fig()
np_cumulate_vac: np.ndarray = np.cumsum(
np_data_vac[:, age_group.value, field.value], axis=0
)
np_cumulate_unvac: np.ndarray = np.cumsum(
np_data_unvac[:, age_group.value, field.value], axis=0
)
plt.plot(np_date, np_cumulate_vac, label=f"{age_group.label} Vaccinés")
plt.plot(np_date, np_cumulate_unvac, label=f"{age_group.label} Non vaccinés")
plt.plot(np_date, np_cumulate_vac, label=f"Vaccinés")
plt.plot(np_date, np_cumulate_unvac, label=f"Non vaccinés")
plt.title(f"{field.label} cumulés par âge")
plt.xlabel("date")
save_and_close_fig(
fig, os.path.join(OUTPUT_REPOSITORY, f"cumulative_{field.name.lower()}")
)
plt.title(f"{age_group.label} - {field.label}")
plt.xlabel("date")
plt.ylabel("nombre")
save_and_close_fig(
fig, os.path.join(OUTPUT_REPOSITORY, f"cumulative_{age_group.name.lower()}_{field.name.lower()}")
)
def plot_fields_by_age_vac(

View File

@ -35,10 +35,12 @@
</div>
<h3>Hospitalisations/Soins critiques/Décés cumulés par tranches d'âges et status vaccinal</h3>
<div class="plot-container">
{% for field in fields %}
<div class="plot-item">
<img src="{{ static }}/plots/cumulative_{{ field.name.lower() }}.png"/>
</div>
{% for age in ages %}
{% for field in fields %}
<div class="plot-item">
<img src="{{ static }}/plots/cumulative_{{ age.name.lower() }}_{{ field.name.lower() }}.png"/>
</div>
{% endfor %}
{% endfor %}
</div>
</div>