Fix shading
This commit is contained in:
parent
3cae0c6c10
commit
a0daed66ad
19
wsgi.py
19
wsgi.py
@ -109,13 +109,6 @@ def plot(
|
|||||||
) -> str:
|
) -> str:
|
||||||
fig = plt.figure(dpi=300)
|
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:
|
for bez in landesbez_str:
|
||||||
series = df.sum(axis=1) if bez is None else df[bez]
|
series = df.sum(axis=1) if bez is None else df[bez]
|
||||||
plot_df = series.to_frame("Digitale Befragung").replace(0, np.nan)
|
plot_df = series.to_frame("Digitale Befragung").replace(0, np.nan)
|
||||||
@ -199,6 +192,18 @@ def plot(
|
|||||||
for total_target in total_targets:
|
for total_target in total_targets:
|
||||||
plt.axhline(y=total_target, color="#48a9be", linestyle="--")
|
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()
|
plt.tight_layout()
|
||||||
|
|
||||||
return fig
|
return fig
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user