Compare commits
No commits in common. "bd804f146403892c0e944c1807a85c755165b05e" and "976ddc6c23939dcdc0776ab37b4c3af276a6161e" have entirely different histories.
bd804f1464
...
976ddc6c23
5
plot.py
5
plot.py
@ -1,18 +1,15 @@
|
|||||||
import datetime
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import fire
|
import fire
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
from wsgi import create_fig, create_plot_df
|
from wsgi import create_fig
|
||||||
|
|
||||||
|
|
||||||
def main(folder: str = "plots"):
|
def main(folder: str = "plots"):
|
||||||
fig, _df, _df_state, timestamp = create_fig()
|
fig, _df, _df_state, timestamp = create_fig()
|
||||||
timestamp = timestamp.replace(" ", "_")
|
timestamp = timestamp.replace(" ", "_")
|
||||||
timestamp = timestamp.replace(":", "-")
|
timestamp = timestamp.replace(":", "-")
|
||||||
plot_df = create_plot_df(datetime.datetime.now(), _df_state)
|
|
||||||
print(plot_df.sum(1))
|
|
||||||
fig.savefig(Path(folder) / f"digital_plot_{timestamp}.png", dpi=300)
|
fig.savefig(Path(folder) / f"digital_plot_{timestamp}.png", dpi=300)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
12
wsgi.py
12
wsgi.py
@ -93,7 +93,7 @@ def plot(
|
|||||||
curr_datetime,
|
curr_datetime,
|
||||||
df: pd.DataFrame,
|
df: pd.DataFrame,
|
||||||
annotate_current: bool = False,
|
annotate_current: bool = False,
|
||||||
total_targets: tuple[int, ...] = (1500, 2500, 3500),
|
total_targets: tuple[int, ...] = (1500,),
|
||||||
alpha: float | None = None,
|
alpha: float | None = None,
|
||||||
landesbez_str: str | None = None,
|
landesbez_str: str | None = None,
|
||||||
) -> str:
|
) -> str:
|
||||||
@ -151,15 +151,7 @@ def plot(
|
|||||||
|
|
||||||
plt.title("Teilnahme an Digitaler Beschäftigtenbefragung")
|
plt.title("Teilnahme an Digitaler Beschäftigtenbefragung")
|
||||||
plt.ylabel("# Teilnahmen")
|
plt.ylabel("# Teilnahmen")
|
||||||
|
plt.ylim(0, total_targets[0] + 100)
|
||||||
max_val = df.sum(axis=1).max().item()
|
|
||||||
|
|
||||||
nearest_target = np.array(total_targets, dtype=np.float32) - max_val
|
|
||||||
nearest_target[nearest_target <= 0] = np.inf
|
|
||||||
idx = np.argmin(nearest_target)
|
|
||||||
|
|
||||||
ceil_val = max(max_val, total_targets[idx])
|
|
||||||
plt.ylim(0, ceil_val * 1.025)
|
|
||||||
plt.legend()
|
plt.legend()
|
||||||
|
|
||||||
# use timezone offset to center tick labels
|
# use timezone offset to center tick labels
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user