From 204f023229e4ae4f2b1f1fddb3beb474f52c8e8e Mon Sep 17 00:00:00 2001 From: Amaury Chamayou Date: Fri, 31 Dec 2021 09:29:24 +0000 Subject: [PATCH] fix tgt only (#132) --- cimetrics/plot.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cimetrics/plot.py b/cimetrics/plot.py index 0ac2d2f..4d94672 100644 --- a/cimetrics/plot.py +++ b/cimetrics/plot.py @@ -336,11 +336,12 @@ def trend_view(env, tgt_only=False): yticks.append(tgt_ewma[col].values[-1]) ax.yaxis.set_ticks(yticks, fontsize="small") mv, rv = None, None - if col in tgt_ewma: - percent_change = 100 * (branch_val - lewm) / lewm - sign = "+" if percent_change > 0 else "" - mv = branch_val - rv = f"{sign}{percent_change:.0f}%" + if not tgt_only: + if col in tgt_ewma: + percent_change = 100 * (branch_val - lewm) / lewm + sign = "+" if percent_change > 0 else "" + mv = branch_val + rv = f"{sign}{percent_change:.0f}%" ax.yaxis.set_major_formatter( mtick.FuncFormatter(make_ticklabel_formatter(yticks[0], mv, rv)) )