From 6d44735ef5700a14712bf15fa9b09cc804c59eca Mon Sep 17 00:00:00 2001 From: Samuel ORTION Date: Sun, 21 Aug 2022 09:45:53 +0200 Subject: [PATCH] plotter: fix date and creation date footnote --- daemon/plotter/chart.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/daemon/plotter/chart.py b/daemon/plotter/chart.py index 064463f..5028dfe 100755 --- a/daemon/plotter/chart.py +++ b/daemon/plotter/chart.py @@ -12,6 +12,7 @@ CONFIG = { "palette": "Greens", "db": "./var/db.sqlite", "date": datetime.now().strftime("%Y-%m-%d") + # "date": "2022-08-15" } db = sqlite3.connect(CONFIG['db']) @@ -34,8 +35,8 @@ if top_on_date.empty: df_top_on_date = df_on_date[df_on_date['common_name'].isin(top_on_date.index)] # Create a figure with 2 subplots -fig, axs = plt.subplots(1, 2, figsize=(15, 4), gridspec_kw=dict( - width_ratios=[3, 6])) +fig, axs = plt.subplots(1, 2, figsize=(20, 5), gridspec_kw=dict( + width_ratios=[2, 6])) plt.subplots_adjust(left=None, bottom=None, right=None, top=None, wspace=0, hspace=0) @@ -86,9 +87,8 @@ for _, spine in plot.spines.items(): plot.set(ylabel=None) plot.set(xlabel="Hour of day") -fig.subplots_adjust(top=0.9) plt.suptitle(f"Top {CONFIG['readings']} species on {CONFIG['date']}", fontsize=14) -plt.title(f"(Updated on {datetime.now().strftime('%Y/%m-%d %H:%M')})") +plt.text(15, 11, f"(Updated on {datetime.now().strftime('%Y/%m-%d %H:%M')})") plt.savefig(f"./var/charts/chart_{CONFIG['date']}.png", dpi=300) plt.close()