From fe35413e36b41089cea7201461a7af5b12f4536d Mon Sep 17 00:00:00 2001 From: Michael DM Dryden Date: Fri, 5 Jun 2020 02:43:30 -0400 Subject: [PATCH] stats: Set history line alpha to 1 if no averages being plotted --- telegram_stats_bot/stats.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/telegram_stats_bot/stats.py b/telegram_stats_bot/stats.py index 1d84e8a..ded72c1 100644 --- a/telegram_stats_bot/stats.py +++ b/telegram_stats_bot/stats.py @@ -444,10 +444,13 @@ class StatsRunner(object): averages = 0 if averages: df['msg_rolling'] = df['messages'].rolling(averages, center=True).mean() + alpha = 0.5 + else: + alpha = 1 fig = Figure() # TODO: One day pandas will let you use constrained_layout=True here... subplot = fig.subplots() - df.plot(x='day', y='messages', alpha=0.5, legend=False, ax=subplot) + df.plot(x='day', y='messages', alpha=alpha, legend=False, ax=subplot) if averages: df.plot(x='day', y='msg_rolling', legend=False, ax=subplot) subplot.set_ylabel("Messages")