prophet icon indicating copy to clipboard operation
prophet copied to clipboard

get values from plot_component

Open akmalsabri opened this issue 6 years ago • 4 comments

Hi, how to get the values from plot component ?

For example yearly component.

akmalsabri avatar Sep 04 '20 07:09 akmalsabri

These are all columns in the forecast dataframe returned by m.predict().

forecast = m.predict(future)
print(forecast.head())
print(forecast['yearly'])  # This is the yearly component

bletham avatar Sep 05 '20 01:09 bletham

Thanks, actually I want to plot the yearly component but not using matplotlib. Now, I understand that yearly values are from forecast dataframe right? But not sure about the x-axis. Maybe I need to create new function, try to understand the original code right?

https://github.com/facebook/prophet/blob/master/python/fbprophet/plot.py

akmalsabri avatar Sep 07 '20 04:09 akmalsabri

from this forum https://stackoverflow.com/questions/47946518/python-fbprophet-export-values-from-plot-components-for-yearly , is that correct the yearly plot are last year plot from forecast datafrmae?

akmalsabri avatar Sep 08 '20 04:09 akmalsabri

The way this is done in the components plot is to generate a dataframe with 1-year daily sequence of dates and then predict the seasonal components on that: https://github.com/facebook/prophet/blob/77da5b8c06d05d478af510198c685d454342db1f/python/fbprophet/plot.py#L339-L341

bletham avatar Sep 08 '20 16:09 bletham