feat: Refactored annotations, added new partial AstraZeneca stop
This commit is contained in:
parent
0020d2b034
commit
4b828cdad9
1 changed files with 12 additions and 7 deletions
19
plot.py
19
plot.py
|
@ -308,15 +308,20 @@ def save_plot(plot_name):
|
||||||
|
|
||||||
print('Created plot {} as {}'.format(plot_name, file_formats))
|
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):
|
def add_annotations(ax):
|
||||||
ax.axvspan(datetime.datetime(2021, 3, 15), datetime.datetime(2021, 3, 19), color='lightgrey', alpha=0.5)
|
labeled_timeperiod(ax, datetime.date(2021, 3, 15), datetime.date(2021, 3, 19), 'AZ-Stopp', 'silver')
|
||||||
ax.text(datetime.datetime(2021, 3, 17), ax.get_ylim()[1], 'AZ-Stopp', bbox={
|
labeled_timeperiod(ax, datetime.date(2021, 3, 29), today, 'AZ-Stopp u. 60', 'lightgrey')
|
||||||
'boxstyle': 'square',
|
|
||||||
'fc': 'white',
|
|
||||||
'ec': 'black'
|
|
||||||
},
|
|
||||||
ha='center')
|
|
||||||
|
|
||||||
def plot_vaccination_bar_graph_total_time():
|
def plot_vaccination_bar_graph_total_time():
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue