Compare commits

..
4 Commits
Author SHA1 Message Date
Felix Blanke 196972b90b Fix fallback 2023-12-03 12:57:01 +01:00
Felix Blanke d205625ef4 Update plot 2023-09-28 20:38:48 +02:00
Felix Blanke 6060930208 Tweak plot params 2023-09-20 02:49:26 +02:00
Felix Blanke 0cd5377442 Tweak plot params 2023-09-20 02:46:34 +02:00
+8 -5
View File
@@ -113,7 +113,10 @@ def plot(
fix_lims: bool = True, fix_lims: bool = True,
max_shading_date=None, max_shading_date=None,
) -> str: ) -> str:
fig = plt.figure(dpi=300) fig = plt.figure(dpi=300, figsize=(8.5, 5))
target_time = pd.Timestamp("2023-10-01")
plt.axvline(x=target_time, color="tab:green", linestyle=":")
if fix_lims: if fix_lims:
for total_target in total_targets: for total_target in total_targets:
@@ -173,7 +176,7 @@ def plot(
idx = np.argmin(nearest_target) idx = np.argmin(nearest_target)
ceil_val = max(max_val, total_targets[idx]) ceil_val = max(max_val, total_targets[idx])
plt.ylim(0, ceil_val * 1.025) plt.ylim(0, ceil_val * 1.04)
plt.legend() plt.legend()
# use timezone offset to center tick labels # use timezone offset to center tick labels
@@ -202,14 +205,14 @@ def plot(
# fill weekends # fill weekends
if max_shading_date is None: if max_shading_date is None:
max_shading_date = df.index.max() + datetime.timedelta(days=3) max_shading_date = df.index.max() + datetime.timedelta(days=4)
days = pd.date_range(start="2023-08-14", end=max_shading_date) days = pd.date_range(start="2023-08-14", end=max_shading_date)
for idx, day in enumerate(days[:-1]): for idx, day in enumerate(days[:-1]):
if day.weekday() >= 5: if day.weekday() >= 5:
plt.gca().axvspan(days[idx], days[idx + 1], alpha=0.2, color="gray") plt.gca().axvspan(days[idx], days[idx + 1], alpha=0.2, color="gray")
# reset xlim # reset xlim
plt.xlim(xlim) plt.xlim((xlim[0], pd.Timestamp("2023-10-02")))
plt.tight_layout() plt.tight_layout()
@@ -251,7 +254,7 @@ def create_fig(
{"Digitale Befragung": "Int32"} {"Digitale Befragung": "Int32"}
) )
plot_df = create_plot_df(curr_datetime) plot_df = create_plot_df(curr_datetime, df_state)
annotate_current = False annotate_current = False
timestamp = Markup(f'<font color="red">{key} 10:00:00</font>') timestamp = Markup(f'<font color="red">{key} 10:00:00</font>')