From 3045c5d8c1423f37475812fc8fa39f613653f58f Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Sun, 5 May 2024 17:51:53 +0200 Subject: [PATCH] Fix : set_ticklabels warning (#52) * Fix set_ticklabels warning * Update daily_plot.py * Comment * Update daily_plot.py --- scripts/daily_plot.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/daily_plot.py b/scripts/daily_plot.py index 53b8900..0ac2abc 100755 --- a/scripts/daily_plot.py +++ b/scripts/daily_plot.py @@ -98,6 +98,9 @@ def create_plot(df_plt_today, now, is_top=None): # Try plot grid lines between bars - problem at the moment plots grid lines on bars - want between bars yticklabels = ['\n'.join(textwrap.wrap(ticklabel.get_text(), 16)) for ticklabel in plot.get_yticklabels()] + # Next two lines avoid a UserWarning on set_ticklabels() requesting a fixed number of ticks + yticks = plot.get_yticks() + plot.set_yticks(yticks) plot.set_yticklabels(yticklabels, fontsize=10) plot.set(ylabel=None) plot.set(xlabel="Detections")