pmdarima.utils.plot_acf
- pmdarima.utils.plot_acf(series, ax=None, lags=None, alpha=None, use_vlines=True, unbiased=False, fft=True, title='Autocorrelation', zero=True, vlines_kwargs=None, show=True, **kwargs)[source][source]
Plot a series’ auto-correlation as a line plot.
A wrapper method for the statsmodels
plot_acfmethod.- Parameters:
- seriesarray-like, shape=(n_samples,)
The series or numpy array for which to plot an auto-correlation.
- axMatplotlib AxesSubplot instance, optional
If given, this subplot is used to plot in instead of a new figure being created.
- lagsint, array-like or None, optional (default=None)
int or Array of lag values, used on horizontal axis. Uses np.arange(lags) when lags is an int. If not provided,
lags=np.arange(len(corr))is used.- alphascalar, optional (default=None)
If a number is given, the confidence intervals for the given level are returned. For instance if alpha=.05, 95 % confidence intervals are returned where the standard deviation is computed according to Bartlett’s formula. If None, no confidence intervals are plotted.
- use_vlinesbool, optional (default=True)
If True, vertical lines and markers are plotted. If False, only markers are plotted. The default marker is ‘o’; it can be overridden with a
markerkwarg.- unbiasedbool, optional (default=False)
If True, then denominators for autocovariance are n-k, otherwise n
- fftbool, optional (default=True)
If True, computes the ACF via FFT.
- titlestr, optional (default=’Autocorrelation’)
Title to place on plot. Default is ‘Autocorrelation’
- zerobool, optional (default=True)
Flag indicating whether to include the 0-lag autocorrelation. Default is True.
- vlines_kwargsdict, optional (default=None)
Optional dictionary of keyword arguments that are passed to vlines.
- showbool, optional (default=True)
Whether to show the plot after it’s been created. If not, will return the plot as an Axis object instead.
- **kwargskwargs, optional
Optional keyword arguments that are directly passed on to the Matplotlib
plotandaxhlinefunctions.
- Returns:
- pltAxis or None
If
showis True, does not return anything. If False, returns the Axis object.
Notes
This method will only show the plot if
show=True(which is the default behavior). To simply get the axis back (say, to add to another canvas), useshow=False.Examples
>>> plot_acf([1, 2, 3], show=False) <matplotlib.figure.Figure object at 0x122fab4e0>