diff --git a/wsgi.py b/wsgi.py index cb002f1..25ed44c 100644 --- a/wsgi.py +++ b/wsgi.py @@ -112,36 +112,35 @@ def plot( series = df.sum(axis=1) if landesbez_str is None else df[landesbez_str] plot_df = series.to_frame("Digitale Befragung").replace(0, np.nan) plot_df = plot_df.astype({"Digitale Befragung": "float32"}) - if pd.isna(plot_df).all().item(): - continue - if alpha is not None: - plt.fill_between( + if not pd.isna(plot_df).all().item(): + if alpha is not None: + plt.fill_between( + plot_df.dropna().index, + plot_df.dropna()["Digitale Befragung"], + color="#e4004e", + alpha=alpha, + ) + + plt.plot( plot_df.dropna().index, plot_df.dropna()["Digitale Befragung"], + ls="--", + marker="o", + lw=1, color="#e4004e", - alpha=alpha, + markersize=4, + label=landesbez_str, ) - plt.plot( - plot_df.dropna().index, - plot_df.dropna()["Digitale Befragung"], - ls="--", - marker="o", - lw=1, - color="#e4004e", - markersize=4, - label=landesbez_str, - ) + if current_df is not None: + plt.annotate( + "Jetzt", + (plot_df.dropna().index[-1], plot_df.dropna()["Digitale Befragung"][-1] * 1.03), + fontsize=8, + ha="center", + ) - if current_df is not None: - plt.annotate( - "Jetzt", - (plot_df.dropna().index[-1], plot_df.dropna()["Digitale Befragung"][-1] * 1.03), - fontsize=8, - ha="center", - ) - - plt.plot(plot_df.index, plot_df["Digitale Befragung"], lw=1.5, color="#e4004e", label=landesbez_str,) + plt.plot(plot_df.index, plot_df["Digitale Befragung"], lw=1.5, color="#e4004e", label=landesbez_str,) plt.title("Teilnahme an Digitaler Beschäftigtenbefragung") plt.ylabel("# Teilnahmen")