Compare commits
No commits in common. "78d4a48643caba6ca5d99662548d047534f78964" and "55147eeed57ddb0496d7b0b4f21adcf6037cf8a1" have entirely different histories.
78d4a48643
...
55147eeed5
1 changed files with 3 additions and 14 deletions
17
plot.py
17
plot.py
|
@ -46,14 +46,9 @@ dates = impfungen['Datum']
|
||||||
daily = impfungen['Gesamtzahl Impfungen']
|
daily = impfungen['Gesamtzahl Impfungen']
|
||||||
cumulative = np.cumsum(impfungen['Gesamtzahl Impfungen'])
|
cumulative = np.cumsum(impfungen['Gesamtzahl Impfungen'])
|
||||||
|
|
||||||
total_vaccinations = int(np.sum(daily))
|
|
||||||
total_vaccinations_percentage = float(total_vaccinations) / einwohner_deutschland
|
|
||||||
print(total_vaccinations_percentage)
|
|
||||||
|
|
||||||
mean_vaccinations_daily = np.mean(daily)
|
mean_vaccinations_daily = np.mean(daily)
|
||||||
mean_vaccinations_daily_int = int(np.round(mean_vaccinations_daily))
|
|
||||||
|
|
||||||
to_be_vaccinated = einwohner_deutschland - total_vaccinations
|
to_be_vaccinated = einwohner_deutschland - np.sum(daily)
|
||||||
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)])
|
||||||
|
@ -61,7 +56,6 @@ 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()
|
||||||
|
@ -84,12 +78,7 @@ 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: {}\n'
|
'Erstellung: {}, Datenquelle: RKI, Stand: {}'.format(print_percentage, print_today, print_stand)
|
||||||
'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()
|
||||||
|
@ -100,7 +89,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(mean_vaccinations_daily_int))
|
ax2.plot(extrapolated_dates, extrapolated_vaccinations, color='orange', label='Kumulierte Impfungen (linear extrap.)')
|
||||||
#ax2.plot()
|
#ax2.plot()
|
||||||
|
|
||||||
ax.legend(loc='upper left')
|
ax.legend(loc='upper left')
|
||||||
|
|
Loading…
Reference in a new issue