

def plot_predict(self, start=None, end=None, exog=None, dynamic=False, alpha=0.05, plot_insample=True, ax=None):
    from statsmodels.graphics.utils import _import_mpl, create_mpl_ax
    _ = _import_mpl()
    (fig, ax) = create_mpl_ax(ax)
    forecast = self.predict(start, end, exog, 'levels', dynamic)
    start = self.model._get_predict_start(start, dynamic=dynamic)
    (end, out_of_sample) = self.model._get_predict_end(end, dynamic=dynamic)
    if out_of_sample:
        steps = out_of_sample
        fc_error = self._forecast_error(steps)
        conf_int = self._forecast_conf_int(forecast[(- steps):], fc_error, alpha)
    if hasattr(self.data, 'predict_dates'):
        from pandas import Series
        forecast = Series(forecast, index=self.data.predict_dates)
        ax = forecast.plot(ax=ax, label='forecast')
    else:
        ax.plot(forecast)
    x = ax.get_lines()[(- 1)].get_xdata()
    if out_of_sample:
        label = '{0:.0%} confidence interval'.format((1 - alpha))
        ax.fill_between(x[(- out_of_sample):], conf_int[:, 0], conf_int[:, 1], color='gray', alpha=0.5, label=label)
    if plot_insample:
        import re
        k_diff = self.k_diff
        label = re.sub('D\\d*\\.', '', self.model.endog_names)
        levels = unintegrate(self.model.endog, self.model._first_unintegrate)
        ax.plot(x[:((end + 1) - start)], levels[(start + k_diff):((end + k_diff) + 1)], label=label)
    ax.legend(loc='best')
    return fig

dataset/ETHPy150Open statsmodels/statsmodels/statsmodels/tsa/arima_model.py ARIMAResults.plot_predict/original