From d2d157c47980e30425f571e9dd19c408bad5c50c Mon Sep 17 00:00:00 2001 From: Felix Blanke Date: Thu, 7 Sep 2023 12:37:02 +0200 Subject: [PATCH] Simplify plot --- wsgi.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wsgi.py b/wsgi.py index 2305605..40677aa 100644 --- a/wsgi.py +++ b/wsgi.py @@ -104,13 +104,13 @@ def create_plot_df( def plot( - curr_datetime, df: pd.DataFrame, annotate_current: bool = False, total_targets: tuple[int, ...] = (1500, 2500, 3500), alpha: float | None = None, landesbez_str: str | None = None, fix_lims: bool = True, + max_shading_date = None, ) -> str: fig = plt.figure(dpi=300) @@ -200,8 +200,9 @@ def plot( xlim = plt.xlim() # fill weekends - max_date = curr_datetime + datetime.timedelta(days=3) - days = pd.date_range(start="2023-08-14", end=max_date) + if max_shading_date is None: + max_shading_date = df.index.max() + datetime.timedelta(days=3) + days = pd.date_range(start="2023-08-14", end=max_shading_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") @@ -262,7 +263,6 @@ def create_fig( ] return ( plot( - curr_datetime, plot_df, annotate_current=annotate_current, landesbez_str=landesbez_strs,