Show StatsForecast plot in VS Code

92 Views Asked by At

I'm trying the StatsForecast package, but I can't get it to display a figure in VS Code (NOT using Jupyter Notebooks).

With Matplotlib, I'd just use the plt.show() method to see the figure in a separate window. However, I can't find the method for StatsForecast. Here is a reproducuble example:

import pandas as pd
import matplotlib.pyplot as plt
import os
os.environ['NIXTLA_ID_AS_COL'] = '1'

df = pd.read_csv('https://datasets-nixtla.s3.amazonaws.com/air-passengers.csv', parse_dates=['ds'])

from statsforecast import StatsForecast
from statsforecast.models import AutoARIMA

sf = StatsForecast(models=[AutoARIMA(season_length = 12)],freq='M')

sf.fit(df)

forecast_df = sf.predict(h=12, level=[90])

sf.plot(df, forecast_df, level=[90], engine="matplotlib")
plt.show()

I get message: <Figure size 2400x350 with 1 Axes>, so the figure was generated but not displayed.

0

There are 0 best solutions below