degroup cumulative plots by age
This commit is contained in:
parent
fae3ca91ae
commit
4c41b44d77
12
drees.py
12
drees.py
@ -386,23 +386,23 @@ 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.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_{field.name.lower()}")
|
||||
fig, os.path.join(OUTPUT_REPOSITORY, f"cumulative_{age_group.name.lower()}_{field.name.lower()}")
|
||||
)
|
||||
|
||||
|
||||
|
||||
@ -35,11 +35,13 @@
|
||||
</div>
|
||||
<h3>Hospitalisations/Soins critiques/Décés cumulés par tranches d'âges et status vaccinal</h3>
|
||||
<div class="plot-container">
|
||||
{% for age in ages %}
|
||||
{% for field in fields %}
|
||||
<div class="plot-item">
|
||||
<img src="{{ static }}/plots/cumulative_{{ field.name.lower() }}.png"/>
|
||||
<img src="{{ static }}/plots/cumulative_{{ age.name.lower() }}_{{ field.name.lower() }}.png"/>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user