degroup cumulative plots by age
This commit is contained in:
parent
fae3ca91ae
commit
4c41b44d77
18
drees.py
18
drees.py
@ -386,24 +386,24 @@ def plot_bar_age_percent_by_field(
|
|||||||
def plot_cumulative_field(
|
def plot_cumulative_field(
|
||||||
np_data: np.ndarray, np_date: np.ndarray, field: Field
|
np_data: np.ndarray, np_date: np.ndarray, field: Field
|
||||||
) -> None:
|
) -> None:
|
||||||
fig, _ = get_plot_fig()
|
|
||||||
np_data_vac, np_data_unvac = split_by_vac_status(np_data)
|
np_data_vac, np_data_unvac = split_by_vac_status(np_data)
|
||||||
|
|
||||||
for age_group in AgeGroup:
|
for age_group in AgeGroup:
|
||||||
|
fig, _ = get_plot_fig()
|
||||||
np_cumulate_vac: np.ndarray = np.cumsum(
|
np_cumulate_vac: np.ndarray = np.cumsum(
|
||||||
np_data_vac[:, age_group.value, field.value], axis=0
|
np_data_vac[:, age_group.value, field.value], axis=0
|
||||||
)
|
)
|
||||||
np_cumulate_unvac: np.ndarray = np.cumsum(
|
np_cumulate_unvac: np.ndarray = np.cumsum(
|
||||||
np_data_unvac[:, age_group.value, field.value], axis=0
|
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_vac, label=f"Vaccinés")
|
||||||
plt.plot(np_date, np_cumulate_unvac, label=f"{age_group.label} Non 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.xlabel("date")
|
||||||
save_and_close_fig(
|
plt.ylabel("nombre")
|
||||||
fig, os.path.join(OUTPUT_REPOSITORY, f"cumulative_{field.name.lower()}")
|
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(
|
def plot_fields_by_age_vac(
|
||||||
|
|||||||
@ -35,10 +35,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<h3>Hospitalisations/Soins critiques/Décés cumulés par tranches d'âges et status vaccinal</h3>
|
<h3>Hospitalisations/Soins critiques/Décés cumulés par tranches d'âges et status vaccinal</h3>
|
||||||
<div class="plot-container">
|
<div class="plot-container">
|
||||||
{% for field in fields %}
|
{% for age in ages %}
|
||||||
<div class="plot-item">
|
{% for field in fields %}
|
||||||
<img src="{{ static }}/plots/cumulative_{{ field.name.lower() }}.png"/>
|
<div class="plot-item">
|
||||||
</div>
|
<img src="{{ static }}/plots/cumulative_{{ age.name.lower() }}_{{ field.name.lower() }}.png"/>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user