feat: Added annotation for AstraZeneca stop for multiple plots
This commit is contained in:
parent
093ee5f073
commit
2cbac85166
1 changed files with 30 additions and 3 deletions
33
plot.py
33
plot.py
|
@ -37,7 +37,7 @@ print_today = today.isoformat()
|
|||
|
||||
filename_now = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
|
||||
|
||||
force_renew_plots = False
|
||||
force_renew_plots = True
|
||||
force_renew_dashboard = True
|
||||
|
||||
# https://www.tagesschau.de/ausland/europa/ursula-von-der-leyen-zu-corona-impfstoffen-101.html
|
||||
|
@ -309,6 +309,15 @@ def save_plot(plot_name):
|
|||
print('Created plot {} as {}'.format(plot_name, file_formats))
|
||||
|
||||
|
||||
def add_annotations(ax):
|
||||
ax.axvspan(datetime.datetime(2021, 3, 15), datetime.datetime(2021, 3, 19), color='lightgrey', alpha=0.5)
|
||||
ax.text(datetime.datetime(2021, 3, 17), ax.get_ylim()[1], 'AZ-Stopp', bbox={
|
||||
'boxstyle': 'square',
|
||||
'fc': 'white',
|
||||
'ec': 'black'
|
||||
},
|
||||
ha='center')
|
||||
|
||||
def plot_vaccination_bar_graph_total_time():
|
||||
|
||||
plot_name = 'vaccination_bar_graph_total_time'
|
||||
|
@ -338,6 +347,8 @@ def plot_vaccination_bar_graph_total_time():
|
|||
ax.set_xlabel('Datum')
|
||||
ax.set_ylabel('Tägliche Impfungen')
|
||||
|
||||
add_annotations(ax)
|
||||
|
||||
save_plot(plot_name)
|
||||
plt.close()
|
||||
|
||||
|
@ -390,7 +401,7 @@ def plot_vaccination_bar_graph_total_time_by_week():
|
|||
|
||||
if i == 12:
|
||||
# Woche der AstraZeneca-Aussetzung
|
||||
plt.annotate('AstraZeneca-Aussetzung', (x, hg * 1000 + 50000),
|
||||
plt.annotate('AZ-Stopp', (x, hg * 1000 + 50000),
|
||||
xytext=(x, ax.get_ylim()[1]),
|
||||
arrowprops={
|
||||
'arrowstyle': '->'
|
||||
|
@ -399,7 +410,9 @@ def plot_vaccination_bar_graph_total_time_by_week():
|
|||
'boxstyle': 'square',
|
||||
'fc': 'white',
|
||||
'ec': 'black'
|
||||
})
|
||||
},
|
||||
ha='center')
|
||||
|
||||
|
||||
i = i + 1
|
||||
|
||||
|
@ -449,6 +462,8 @@ def plot_vaccination_bar_graph_total_time_two_bars():
|
|||
ax.set_xlabel('Datum')
|
||||
ax.set_ylabel('Tägliche Impfungen')
|
||||
|
||||
add_annotations(ax)
|
||||
|
||||
save_plot(plot_name)
|
||||
plt.close()
|
||||
|
||||
|
@ -525,6 +540,8 @@ def plot_cumulative_two_vaccinations():
|
|||
ax.set_xlabel('Datum')
|
||||
ax.set_ylabel('Kumulative Impfungen')
|
||||
|
||||
add_annotations(ax)
|
||||
|
||||
save_plot(plot_name)
|
||||
plt.close()
|
||||
|
||||
|
@ -565,6 +582,8 @@ def plot_cumulative_two_vaccinations_percentage():
|
|||
ax.set_xlabel('Datum')
|
||||
ax.set_ylabel('Kumulative Impfungen')
|
||||
|
||||
add_annotations(ax)
|
||||
|
||||
save_plot(plot_name)
|
||||
plt.close()
|
||||
|
||||
|
@ -607,6 +626,8 @@ def plot_people_between_first_and_second():
|
|||
ax.set_xlabel('Datum')
|
||||
ax.set_ylabel('Personen zwischen Erst- und Zweitimpfung')
|
||||
|
||||
add_annotations(ax)
|
||||
|
||||
save_plot(plot_name)
|
||||
plt.close()
|
||||
|
||||
|
@ -649,6 +670,8 @@ def plot_vaccination_rate():
|
|||
ax.set_xlabel('Datum')
|
||||
ax.set_ylabel('Impfrate [Impfungen/Tag]')
|
||||
|
||||
add_annotations(ax)
|
||||
|
||||
save_plot(plot_name)
|
||||
plt.close()
|
||||
|
||||
|
@ -688,6 +711,8 @@ def plot_vaccination_done_days():
|
|||
ax.set_xlabel('Datum')
|
||||
ax.set_ylabel('Tage, bis 70 % erreicht sind')
|
||||
|
||||
add_annotations(ax)
|
||||
|
||||
save_plot(plot_name)
|
||||
plt.close()
|
||||
|
||||
|
@ -737,6 +762,8 @@ def plot_vaccination_done_dates():
|
|||
ax.set_xlabel('Datum')
|
||||
ax.set_ylabel('Datum, an dem 70 % erreicht sind')
|
||||
|
||||
add_annotations(ax)
|
||||
|
||||
save_plot(plot_name)
|
||||
plt.close()
|
||||
|
||||
|
|
Loading…
Reference in a new issue