Skip to content

Commit

Permalink
fix tgt only (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
achamayou authored Dec 31, 2021
1 parent 19d2501 commit 204f023
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions cimetrics/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
)
Expand Down

0 comments on commit 204f023

Please sign in to comment.