feat: Added stats to title
Added total vaccinations, vaccination percentage and mean daily vaccination rate to title
This commit is contained in:
parent
386666d5b3
commit
78d4a48643
1 changed files with 15 additions and 4 deletions
19
plot.py
19
plot.py
|
@ -46,9 +46,14 @@ dates = impfungen['Datum']
|
||||||
daily = impfungen['Gesamtzahl Impfungen']
|
daily = impfungen['Gesamtzahl Impfungen']
|
||||||
cumulative = np.cumsum(impfungen['Gesamtzahl Impfungen'])
|
cumulative = np.cumsum(impfungen['Gesamtzahl Impfungen'])
|
||||||
|
|
||||||
mean_vaccinations_daily = np.mean(daily)
|
total_vaccinations = int(np.sum(daily))
|
||||||
|
total_vaccinations_percentage = float(total_vaccinations) / einwohner_deutschland
|
||||||
|
print(total_vaccinations_percentage)
|
||||||
|
|
||||||
to_be_vaccinated = einwohner_deutschland - np.sum(daily)
|
mean_vaccinations_daily = np.mean(daily)
|
||||||
|
mean_vaccinations_daily_int = int(np.round(mean_vaccinations_daily))
|
||||||
|
|
||||||
|
to_be_vaccinated = einwohner_deutschland - total_vaccinations
|
||||||
days_extrapolated = int(np.ceil(to_be_vaccinated / mean_vaccinations_daily))
|
days_extrapolated = int(np.ceil(to_be_vaccinated / mean_vaccinations_daily))
|
||||||
|
|
||||||
extrapolated_dates = np.array([dates[0] + datetime.timedelta(days=i) for i in range(days_extrapolated)])
|
extrapolated_dates = np.array([dates[0] + datetime.timedelta(days=i) for i in range(days_extrapolated)])
|
||||||
|
@ -56,6 +61,7 @@ extrapolated_dates = np.array([dates[0] + datetime.timedelta(days=i) for i in ra
|
||||||
extrapolated_vaccinations = mean_vaccinations_daily * range(days_extrapolated)
|
extrapolated_vaccinations = mean_vaccinations_daily * range(days_extrapolated)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Stand aus Daten auslesen
|
# Stand aus Daten auslesen
|
||||||
#stand = dates.iloc[-1]
|
#stand = dates.iloc[-1]
|
||||||
#print_stand = stand.isoformat()
|
#print_stand = stand.isoformat()
|
||||||
|
@ -78,7 +84,12 @@ def plot_extrapolation_portion(percentage):
|
||||||
|
|
||||||
plt.title(
|
plt.title(
|
||||||
'Tägliche Impfquote, kumulierte Impfungen und lineare Extrapolation bis {} % der Bevölkerung Deutschlands\n'
|
'Tägliche Impfquote, kumulierte Impfungen und lineare Extrapolation bis {} % der Bevölkerung Deutschlands\n'
|
||||||
'Erstellung: {}, Datenquelle: RKI, Stand: {}'.format(print_percentage, print_today, print_stand)
|
'Erstellung: {}, Datenquelle: RKI, Stand: {}\n'
|
||||||
|
'Impfungen gesamt: {} ({} %), Durchschnittliche Impfrate: {} Impfungen/Tag'.format(
|
||||||
|
print_percentage,
|
||||||
|
print_today, print_stand,
|
||||||
|
total_vaccinations, np.round(total_vaccinations_percentage * 100, 2), mean_vaccinations_daily_int
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
ax2 = ax.twinx()
|
ax2 = ax.twinx()
|
||||||
|
@ -89,7 +100,7 @@ def plot_extrapolation_portion(percentage):
|
||||||
ax2.set_xlim(xmax=dates[0] + datetime.timedelta(days=percentage * days_extrapolated))
|
ax2.set_xlim(xmax=dates[0] + datetime.timedelta(days=percentage * days_extrapolated))
|
||||||
ax2.grid(True)
|
ax2.grid(True)
|
||||||
ax2.plot(dates, cumulative, color='red', label='Kumulierte Impfungen')
|
ax2.plot(dates, cumulative, color='red', label='Kumulierte Impfungen')
|
||||||
ax2.plot(extrapolated_dates, extrapolated_vaccinations, color='orange', label='Extrap. kumulierte Impfungen\n({} Impfungen/Tag)'.format(int(np.round(mean_vaccinations_daily))))
|
ax2.plot(extrapolated_dates, extrapolated_vaccinations, color='orange', label='Extrap. kumulierte Impfungen\n({} Impfungen/Tag)'.format(mean_vaccinations_daily_int))
|
||||||
#ax2.plot()
|
#ax2.plot()
|
||||||
|
|
||||||
ax.legend(loc='upper left')
|
ax.legend(loc='upper left')
|
||||||
|
|
Loading…
Reference in a new issue