1
0
Fork 0

feat: Added new plot that shows total number of people between vaccinations

This commit is contained in:
Benedikt Bastin 2021-02-04 19:14:12 +01:00
parent 39993742c9
commit da8a85809c
2 changed files with 64 additions and 0 deletions

View File

@ -261,6 +261,19 @@
<a href="cumulative_two_vaccinations_percentage.pdf" download="cumulative_two_vaccinations_percentage.pdf">Download als PDF</a>
</figcaption>
</figure>
<figure>
<a href="people_between_first_and_second.png">
<img
src="people_between_first_and_second.png"
alt="" />
</a>
<figcaption>
<a name="figure-009"><span class="ref">Abbildung 9:</span></a>
Anzahl der Personen zwischen Erst- und Zweitimpfung, also Personen, die die erste Impfung erhalten haben, die zweite aber noch nicht<br />
<a href="people_between_first_and_second.png" download="people_between_first_and_second.png">Download als PNG</a>
<a href="people_between_first_and_second.pdf" download="people_between_first_and_second.pdf">Download als PDF</a>
</figcaption>
</figure>
</section>
<section>

51
plot.py
View File

@ -556,6 +556,57 @@ def plot_cumulative_two_vaccinations_percentage():
plot_cumulative_two_vaccinations_percentage()
def plot_people_between_first_and_second():
archive_plot_filename = '{}/people_between_first_and_second'.format(archive_folder)
latest_plot_filename = '{}/people_between_first_and_second'.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(
'Personen zwischen Erst- und Zweitimpfung\n'
'Datenquelle: RKI, Stand: {}. Erstellung: {}, Ersteller: Benedikt Bastin, Lizenz: CC BY-SA 4.0\n'.format(
print_stand, print_today
)
)
ax.grid()
first_vaccinations_cumulative = data_first_vaccination['cumulative']
second_vaccinations_cumulative = data_second_vaccination['cumulative']
people_between = first_vaccinations_cumulative - second_vaccinations_cumulative
ax.plot(dates, people_between, label='Personen zwischen Erst- und Zweitimpfung', color='darkblue')
ax.bar(dates, data_first_vaccination['daily'], color='blue', label='Erstimpfungen')
ax.bar(dates, -data_second_vaccination['daily'], color='lightblue', label='Zweitimpfungen')
ax.legend(loc='upper left')
ax.xaxis_date()
ax.get_yaxis().get_major_formatter().set_scientific(False)
ax.set_xlabel('Datum')
ax.set_ylabel('Personen zwischen Erst- und Zweitimpfung')
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_people_between_first_and_second()
def render_dashboard():
dashboard_filename = 'site/index.xhtml'
dashboard_archive_filename = 'site/archive/{}/index.xhtml'.format(filename_stand)