From b02d05a1d59e0cec9fda76ced281ac0c2875df61 Mon Sep 17 00:00:00 2001 From: Benedikt Bastin Date: Tue, 20 Apr 2021 15:42:07 +0200 Subject: [PATCH] feat: New plot for vaccination rates of last three weeks --- plot.py | 59 ++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 50 insertions(+), 9 deletions(-) diff --git a/plot.py b/plot.py index b6aa6c7..e027756 100644 --- a/plot.py +++ b/plot.py @@ -276,6 +276,43 @@ def plot_vaccination_bar_graph_total_time(): plot_vaccination_bar_graph_total_time() +def plot_vaccination_bar_graph_last_three_weeks(): + + plot_name = 'vaccination_bar_graph_last_three_weeks' + if not check_recreate_plot(plot_name): + return + + fig, ax = plt.subplots(1) + + + plt.title( + 'Tägliche Impfrate der letzten drei Wochen (Erst- und Zweitimpfung übereinander)\n' + 'Datenquelle: RKI, Stand: {}. Erstellung: {}, Ersteller: Benedikt Bastin, Lizenz: CC BY-SA 4.0\n'.format( + print_stand, print_today + ) + ) + + ax.grid() + + ax.bar(dates, data_first_vaccination['daily'], label='Tägliche Erstimpfungen', color='blue') + ax.bar(dates, data_second_vaccination['daily'], label='Tägliche Zweitimpfungen', color='lightblue', bottom=data_first_vaccination['daily']) + + ax.set_xlim([today - datetime.timedelta(22), today]) + + ax.legend(loc='upper left') + ax.get_yaxis().get_major_formatter().set_scientific(False) + + ax.set_xlabel('Datum') + ax.set_ylabel('Tägliche Impfungen') + + add_annotations(ax) + + save_plot(plot_name) + plt.close() + + +plot_vaccination_bar_graph_last_three_weeks() + def plot_vaccination_bar_graph_total_time_by_week(): plot_name = 'vaccination_bar_graph_total_time_by_week' @@ -801,42 +838,46 @@ def render_dashboard(): 'caption': 'Tägliche Impfrate (Erst- und Zweitimpfung übereinander)' },{ 'index': 2, + 'filename': 'vaccination_bar_graph_last_three_weeks', + 'caption': 'Tägliche Impfrate der letzten drei Wochen (Erst- und Zweitimpfung übereinander)' + },{ + 'index': 3, 'filename': 'vaccination_bar_graph_total_time_by_week', 'caption': 'Wöchentliche Impfrate (Erst- und Zweitimpfung übereinander)' },{ - 'index': 3, + 'index': 4, 'filename': 'vaccination_bar_graph_total_time_two_bars', 'caption': 'Tägliche Impfrate (Erst- und Zweitimpfung nebeneinander)' },{ - 'index': 4, + 'index': 5, 'filename': 'vaccination_bar_graph_compare_both_vaccinations', 'caption': 'Tägliche Impfrate (Erst- und Zweitimpfung nebeneinander)' },{ - 'index': 5, + 'index': 6, 'filename': 'cumulative_two_vaccinations', 'caption': 'Kumulative Impfrate (Erst- und Zweitimpfung)' },{ - 'index': 6, + 'index': 7, 'filename': 'cumulative_two_vaccinations_percentage', 'caption': 'Kumulative Impfrate (Erst- und Zweitimpfung) in Prozent der Bevölkerung Deutschlands' },{ - 'index': 7, + 'index': 8, 'filename': 'people_between_first_and_second', 'caption': 'Anzahl der Personen zwischen Erst- und Zweitimpfung, also Personen, die die erste Impfung erhalten haben, die zweite aber noch nicht' },{ - 'index': 8, + 'index': 9, 'filename': 'vaccination_rate', 'caption': 'Tägliche Impfrate sowie durchschnittliche Impfrate' },{ - 'index': 9, + 'index': 10, 'filename': 'vaccination_done_days', 'caption': 'Lineare Extrapolation bis 70 % der Bevölkerung anhand der Erstimpfungen der durchschnittlichen Impfrate (Anzahl Tage, Gesamt und 7 Tage)' },{ - 'index': 10, + 'index': 11, 'filename': 'vaccination_done_weeks', 'caption': 'Lineare Extrapolation bis 70 % der Bevölkerung anhand der Erstimpfungen der durchschnittlichen Impfrate (Anzahl Wochen, Gesamt und 7 Tage)' },{ - 'index': 11, + 'index': 12, 'filename': 'vaccination_done_dates', 'caption': 'Lineare Extrapolation bis 70 % der Bevölkerung anhand der Erstimpfungen der durchschnittlichen Impfrate (Datum, Gesamt und 7 Tage)' }