Fix shading

This commit is contained in:
Felix Blanke 2023-09-01 23:19:48 +02:00
parent 3cae0c6c10
commit a0daed66ad

19
wsgi.py
View File

@ -109,13 +109,6 @@ def plot(
) -> str:
fig = plt.figure(dpi=300)
# fill weekends
max_date = curr_datetime + datetime.timedelta(days=1)
days = pd.date_range(start="2023-08-14", end=max_date)
for idx, day in enumerate(days[:-1]):
if day.weekday() >= 5:
plt.gca().axvspan(days[idx], days[idx + 1], alpha=0.2, color="gray")
for bez in landesbez_str:
series = df.sum(axis=1) if bez is None else df[bez]
plot_df = series.to_frame("Digitale Befragung").replace(0, np.nan)
@ -199,6 +192,18 @@ def plot(
for total_target in total_targets:
plt.axhline(y=total_target, color="#48a9be", linestyle="--")
xlim = plt.xlim()
# fill weekends
max_date = curr_datetime + datetime.timedelta(days=3)
days = pd.date_range(start="2023-08-14", end=max_date)
for idx, day in enumerate(days[:-1]):
if day.weekday() >= 5:
plt.gca().axvspan(days[idx], days[idx + 1], alpha=0.2, color="gray")
# reset xlim
plt.xlim(xlim)
plt.tight_layout()
return fig