prophet icon indicating copy to clipboard operation
prophet copied to clipboard

How to make plotly work?

Open raphael10-collab opened this issue 5 months ago • 1 comments

I do not understand how to make plotly work with prophet

import logging
logging.getLogger("prophet.plot").disabled = True
import prophet
import matplotlib.pyplot as plt
import pandas as pd

data = pd.read_csv("example_wp_log_peyton_manning.csv")
data["ds"] = pd.to_datetime(data["ds"])

fig = plt.figure(facecolor='w', figsize=(10, 6))
plt.plot(data.ds, data.y)

I do not get the warning anymore, but plotly does not work

raphael10-collab avatar Sep 01 '25 14:09 raphael10-collab

Here's an example of how to use plotly @raphael10-collab :

from prophet.plot import plot_plotly
....

df =  None # Prepare data for Prophet

model = Prophet(
    daily_seasonality=False,
    weekly_seasonality=True,
    yearly_seasonality=True, 
)

model.fit(df)
 
# Create dataframe and make prediction
future = model.make_future_dataframe(periods=30)
forecast = model.predict(future)

# Visualisation: Prophet Interactive Forecast Plot
fig = plot_plotly(model, forecast)
fig.update_layout(
    title='S&P 500 Forecast with Prophet (30 Days Ahead)',
    xaxis_title='Date',
    yaxis_title='Price (USD)',
    height=600,
    template='plotly_white'
)
fig.show()

marvelefe avatar Oct 03 '25 14:10 marvelefe