1
0
Fork 0

fix: New annotation for days remaining plot showing extent of weeks remaining plot

This commit is contained in:
Benedikt Bastin 2021-04-14 13:46:19 +02:00
parent a1a4348ea1
commit 580b703fb5

View file

@ -20,6 +20,7 @@ from functools import reduce
from matplotlib.dates import date2num, DateFormatter, WeekdayLocator from matplotlib.dates import date2num, DateFormatter, WeekdayLocator
import matplotlib.dates as mdates import matplotlib.dates as mdates
import matplotlib.ticker as mtick import matplotlib.ticker as mtick
from matplotlib.patches import Rectangle
from isoweek import Week from isoweek import Week
@ -745,13 +746,14 @@ def plot_vaccination_done_days():
ax.grid(True) ax.grid(True)
d = datetime.date(2021, 3, 1)
ax.add_patch(Rectangle((d, 0), today - d, 52 * 7, edgecolor='darkgrey', lw=3, fill=False, label='Detailansicht (s.u.)'))
ax.legend(loc='upper right') ax.legend(loc='upper right')
ax.get_yaxis().get_major_formatter().set_scientific(False) ax.get_yaxis().get_major_formatter().set_scientific(False)
ax.set_xlabel('Datum') ax.set_xlabel('Datum')
ax.set_ylabel('Tage, bis 70 % erreicht sind') ax.set_ylabel('Tage, bis 70 % erreicht sind')
add_annotations(ax) add_annotations(ax)
save_plot(plot_name) save_plot(plot_name)
@ -779,7 +781,7 @@ def plot_vaccination_done_weeks():
weeks_remaining_daily = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['mean_vaccination_rates_daily'])) / 7 weeks_remaining_daily = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['mean_vaccination_rates_daily'])) / 7
weeks_remaining_rolling = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['vaccination_rates_daily_rolling_average'])) / 7 weeks_remaining_rolling = np.ceil((einwohner_deutschland * 0.7 - d['cumulative']) / (d['vaccination_rates_daily_rolling_average'])) / 7
ax.set_xlim(datetime.datetime(2021, 3, 1), today) ax.set_xlim(datetime.date(2021, 3, 1), today)
ax.set_ylim(0, 52) ax.set_ylim(0, 52)
ax.axhline(days_until_target / 7, label='Impfziel Ende Sommer') ax.axhline(days_until_target / 7, label='Impfziel Ende Sommer')