I can not show the prediction graph using prophet

I can get Prophet forecast and I can show the forecast results using st.write(forecast). But I can not show the graph if I use the following coding.

from fbprophet.plot import plot_plotly

fig = plot_plotly(model, forecast)
st.plotly_chart(fig, use_container_width=True)
st.pyplot(fig)

Is there any idea to show prediction graph?

Hi @59er, I’m sorry you’re having trouble plotting the prediction graph from fbprophet. Have you tried the following approach:

from fbprophet import Prophet

model = Prophet() # instantiate the model
model.fit(data) # fit the model to some data
# more modelling stuff
forecast = m.predict(future) # prediction using fitted model

fig = model.plot(forecast) # Prophet's plot method creates a prediction graph
st.write(fig) # display prediction graph

Best, :balloon:
Snehan

Hi, Snehan,

Thank you very much for your advice.
I can display prediction graph!!

So, I think I’ll sleep well tonight.

Thank you.

1 Like