0
from fbprophet import Prophet
from pandas import to_datetime
df=df_date_pink[["Date of Travel",'Number of Passengers']]
df.columns = ['ds', 'y']
df['ds']= to_datetime(df['ds'])
model = Prophet()
model.fit(df)
future = list()
for i in range(1, 13):
    date = '2019-%02d' % i
    future.append([date])
future = pd.DataFrame(future)
future.columns = ['ds']
future['ds']= to_datetime(future['ds'])
forecast = model.predict(future)
print(forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].head())
model.plot(forecast)
plt.gca().get_lines()[0].set_color("deeppink")
plt.title("Pink Cabs Number of Passengers and Its Forecast For The Next Year", size=15)
plt.xlabel("Dates", size=15)
plt.ylabel("Number of Passengers", size=15)
plt.show()

When it is runned I get this

visual produced by the above code

I also want the forecasted lines and the shadowy area "deeppink" as well. How can I do it?

Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158

1 Answers1

0
plt.gca().get_lines()[1].set_color("deeppink")
toyota Supra
  • 3,181
  • 4
  • 15
  • 19
  • 2
    Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. **Would you kindly [edit] your answer to include additional details for the benefit of the community?** – Jeremy Caney Aug 17 '23 at 02:12