From 6c112de3576e8c82fe9ec741bc9fcb994762ce86 Mon Sep 17 00:00:00 2001 From: Benedikt Bastin Date: Mon, 12 Apr 2021 11:51:53 +0200 Subject: [PATCH] feat: Added annotation for start of vaccinations outside vaccination centres --- plot.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plot.py b/plot.py index 7a729d0..60db894 100644 --- a/plot.py +++ b/plot.py @@ -308,10 +308,10 @@ def save_plot(plot_name): print('Created plot {} as {}'.format(plot_name, file_formats)) -def labeled_timeperiod(ax, start, end, text, color='lightgrey'): +def labeled_timeperiod(ax, start, end, text, color='lightgrey', y_height = 100): centre = start + (end - start) / 2 ax.axvspan(start, end, color=color, alpha=0.5) - ax.text(centre, ax.get_ylim()[1], text, bbox={ + ax.text(centre, ax.get_ylim()[1] * (y_height / 100), text, bbox={ 'boxstyle': 'square', 'fc': color, 'ec': 'black' @@ -320,7 +320,8 @@ def labeled_timeperiod(ax, start, end, text, color='lightgrey'): def add_annotations(ax): 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') + labeled_timeperiod(ax, datetime.date(2021, 3, 29), today, 'AZ-Stopp u. 60', 'lightgrey', 96) + labeled_timeperiod(ax, datetime.date(2021, 4, 6), today, 'Arztpraxen impfen', 'lightgreen') def plot_vaccination_bar_graph_total_time():