Do not plot lines if no datapoint in set
This commit is contained in:
parent
11a4cf4248
commit
45647def39
47
wsgi.py
47
wsgi.py
@ -112,36 +112,35 @@ def plot(
|
|||||||
series = df.sum(axis=1) if landesbez_str is None else df[landesbez_str]
|
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 = series.to_frame("Digitale Befragung").replace(0, np.nan)
|
||||||
plot_df = plot_df.astype({"Digitale Befragung": "float32"})
|
plot_df = plot_df.astype({"Digitale Befragung": "float32"})
|
||||||
if pd.isna(plot_df).all().item():
|
if not pd.isna(plot_df).all().item():
|
||||||
continue
|
if alpha is not None:
|
||||||
if alpha is not None:
|
plt.fill_between(
|
||||||
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().index,
|
||||||
plot_df.dropna()["Digitale Befragung"],
|
plot_df.dropna()["Digitale Befragung"],
|
||||||
|
ls="--",
|
||||||
|
marker="o",
|
||||||
|
lw=1,
|
||||||
color="#e4004e",
|
color="#e4004e",
|
||||||
alpha=alpha,
|
markersize=4,
|
||||||
|
label=landesbez_str,
|
||||||
)
|
)
|
||||||
|
|
||||||
plt.plot(
|
if current_df is not None:
|
||||||
plot_df.dropna().index,
|
plt.annotate(
|
||||||
plot_df.dropna()["Digitale Befragung"],
|
"Jetzt",
|
||||||
ls="--",
|
(plot_df.dropna().index[-1], plot_df.dropna()["Digitale Befragung"][-1] * 1.03),
|
||||||
marker="o",
|
fontsize=8,
|
||||||
lw=1,
|
ha="center",
|
||||||
color="#e4004e",
|
)
|
||||||
markersize=4,
|
|
||||||
label=landesbez_str,
|
|
||||||
)
|
|
||||||
|
|
||||||
if current_df is not None:
|
plt.plot(plot_df.index, plot_df["Digitale Befragung"], lw=1.5, color="#e4004e", label=landesbez_str,)
|
||||||
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.title("Teilnahme an Digitaler Beschäftigtenbefragung")
|
plt.title("Teilnahme an Digitaler Beschäftigtenbefragung")
|
||||||
plt.ylabel("# Teilnahmen")
|
plt.ylabel("# Teilnahmen")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user