1
0
Fork 0

feat: Refactored annotations, added new partial AstraZeneca stop

This commit is contained in:
Benedikt Bastin 2021-03-30 20:34:13 +02:00
parent 0020d2b034
commit 4b828cdad9
1 changed files with 12 additions and 7 deletions

19
plot.py
View File

@ -308,15 +308,20 @@ def save_plot(plot_name):
print('Created plot {} as {}'.format(plot_name, file_formats))
def labeled_timeperiod(ax, start, end, text, color='lightgrey'):
centre = start + (end - start) / 2
ax.axvspan(start, end, color=color, alpha=0.5)
ax.text(centre, ax.get_ylim()[1], text, bbox={
'boxstyle': 'square',
'fc': color,
'ec': 'black'
}, ha='center')
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')
labeled_timeperiod(ax, datetime.date(2021, 3, 15), datetime.date(2021, 3, 19), 'AZ-Stopp', 'silver')
labeled_timeperiod(ax, datetime.date(2021, 3, 29), today, 'AZ-Stopp u. 60', 'lightgrey')
def plot_vaccination_bar_graph_total_time():