diff --git a/dashboard_template.xhtml b/dashboard_template.xhtml
index 2b08784..4982e44 100644
--- a/dashboard_template.xhtml
+++ b/dashboard_template.xhtml
@@ -231,12 +231,25 @@
alt="" />
- Abbildung 6:
+ Abbildung 7:
Tägliche Impfrate (Erst- und Zweitimpfung um 21 Tage versetzt)
Download als PNG
Download als PDF
+
diff --git a/plot.py b/plot.py
index 9aea91d..6e438c3 100644
--- a/plot.py
+++ b/plot.py
@@ -13,6 +13,7 @@ import os.path
import shutil
from matplotlib.dates import date2num
+import matplotlib.ticker as mtick
locale.setlocale(locale.LC_ALL, 'de_DE.UTF-8')
@@ -505,6 +506,54 @@ def plot_cumulative_two_vaccinations():
plot_cumulative_two_vaccinations()
+def plot_cumulative_two_vaccinations_percentage():
+ archive_plot_filename = '{}/cumulative_two_vaccinations_percentage'.format(archive_folder)
+ latest_plot_filename = '{}/cumulative_two_vaccinations_percentage'.format(site_folder)
+
+ if os.path.isfile(archive_plot_filename + '.pdf'):
+ print('Plot {} already exists'.format(archive_plot_filename))
+ return
+
+ fig, ax = plt.subplots(1)
+
+
+ plt.title(
+ 'Kumulative Impfrate (Erst- und Zweitimpfung) in Prozent der Bevökerung Deutschlands ({} Einwohner)\n'
+ 'Datenquelle: RKI, Stand: {}. Erstellung: {}, Ersteller: Benedikt Bastin, Lizenz: CC BY-SA 4.0\n'.format(
+ '{:n}'.format(einwohner_deutschland).replace('.', ' '),
+ print_stand, print_today
+ )
+ )
+
+ ax.grid()
+
+ first_vaccinations_cumulative = data_first_vaccination['cumulative'] / einwohner_deutschland
+ second_vaccinations_cumulative = data_second_vaccination['cumulative'] / einwohner_deutschland
+
+ ax.fill_between(dates, first_vaccinations_cumulative, label='Erstimpfungen', color='blue')
+ ax.fill_between(dates, second_vaccinations_cumulative, label='Zweitimpfungen', color='lightblue')
+
+ ax.set_ylim([0, 1])
+
+ ax.legend(loc='upper left')
+ ax.xaxis_date()
+ ax.yaxis.set_major_formatter(mtick.PercentFormatter(1.0))
+
+ ax.set_xlabel('Datum')
+ ax.set_ylabel('Tägliche Impfungen')
+
+
+ plt.savefig(archive_plot_filename + '.pdf')
+ plt.savefig(archive_plot_filename + '.png')
+ plt.savefig(latest_plot_filename + '.pdf')
+ plt.savefig(latest_plot_filename + '.png')
+ plt.close()
+
+ print('Created plot {} as pdf and png'.format(archive_plot_filename))
+
+
+plot_cumulative_two_vaccinations_percentage()
+
def render_dashboard():
dashboard_filename = 'site/index.xhtml'
dashboard_archive_filename = 'site/archive/{}/index.xhtml'.format(filename_stand)