feat: Added plot for cumulative vaccinations
This commit is contained in:
parent
252afdd5bc
commit
af0c17ecf8
2 changed files with 60 additions and 0 deletions
|
@ -222,6 +222,19 @@
|
|||
<a href="vaccination_bar_graph_compare_both_vaccinations.pdf" download="vaccination_bar_graph_compare_both_vaccinations.pdf">Download als PDF</a>
|
||||
</figcaption>
|
||||
</figure>
|
||||
<figure>
|
||||
<a href="cumulative_two_vaccinations.png">
|
||||
<img
|
||||
src="cumulative_two_vaccinations.png"
|
||||
alt="" />
|
||||
</a>
|
||||
<figcaption>
|
||||
<a name="figure-006"><span class="ref">Abbildung 6:</span></a>
|
||||
Tägliche Impfrate (Erst- und Zweitimpfung nebeneinander)<br />
|
||||
<a href="cumulative_two_vaccinations.png" download="cumulative_two_vaccinations.png">Download als PNG</a>
|
||||
<a href="cumulative_two_vaccinations.pdf" download="cumulative_two_vaccinations.pdf">Download als PDF</a>
|
||||
</figcaption>
|
||||
</figure>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
|
|
47
plot.py
47
plot.py
|
@ -457,6 +457,53 @@ def plot_vaccination_bar_graph_compare_both_vaccinations():
|
|||
|
||||
plot_vaccination_bar_graph_compare_both_vaccinations()
|
||||
|
||||
def plot_cumulative_two_vaccinations():
|
||||
archive_plot_filename = '{}/cumulative_two_vaccinations'.format(archive_folder)
|
||||
latest_plot_filename = '{}/cumulative_two_vaccinations'.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)\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']
|
||||
|
||||
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, first_vaccinations_cumulative.iloc[-1]])
|
||||
|
||||
ax.legend(loc='upper left')
|
||||
ax.xaxis_date()
|
||||
ax.get_yaxis().get_major_formatter().set_scientific(False)
|
||||
|
||||
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()
|
||||
|
||||
def render_dashboard():
|
||||
dashboard_filename = 'site/index.xhtml'
|
||||
dashboard_archive_filename = 'site/archive/{}/index.xhtml'.format(filename_stand)
|
||||
|
|
Loading…
Reference in a new issue