mirror of
https://github.com/saymrwulf/prophet.git
synced 2026-05-17 21:10:45 +00:00
Fix plotting with 0 changepoints
This commit is contained in:
parent
9425b89257
commit
a6646670b9
1 changed files with 2 additions and 2 deletions
|
|
@ -441,7 +441,7 @@ def add_changepoints_to_plot(
|
|||
artists.append(ax.plot(fcst['ds'], fcst['trend'], c=cp_color))
|
||||
signif_changepoints = m.changepoints[
|
||||
np.abs(np.nanmean(m.params['delta'], axis=0)) >= threshold
|
||||
]
|
||||
] if len(m.changepoints) > 0 else []
|
||||
for cp in signif_changepoints:
|
||||
artists.append(ax.axvline(x=cp, c=cp_color, ls=cp_linestyle))
|
||||
return artists
|
||||
|
|
@ -628,7 +628,7 @@ def plot_plotly(m, fcst, uncertainty=True, plot_cap=True, trend=False, changepoi
|
|||
line=dict(color=trend_color, width=line_width),
|
||||
))
|
||||
# Add changepoints
|
||||
if changepoints:
|
||||
if changepoints and len(m.changepoints) > 0:
|
||||
signif_changepoints = m.changepoints[
|
||||
np.abs(np.nanmean(m.params['delta'], axis=0)) >= changepoints_threshold
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in a new issue