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():