, ax=None, lags=None, alpha=0.05, use_vlines=True, unbiased=False, fft=False, **kwargs)[source]

Plot the autocorrelation function

Plots lags on the horizontal and the correlations on vertical axis.


x : array_like

Array of time-series values

ax : Matplotlib AxesSubplot instance, optional

If given, this subplot is used to plot in instead of a new figure being created.

lags : array_like, optional

Array of lag values, used on horizontal axis. If not given, lags=np.arange(len(corr)) is used.

alpha : scalar, optional

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_vlines : bool, optional

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 marker kwarg.

unbiased : bool

If True, then denominators for autocovariance are n-k, otherwise n

fft : bool, optional

If True, computes the ACF via FFT.

**kwargs : kwargs, optional

Optional keyword arguments that are directly passed on to the Matplotlib plot and axhline functions.


fig : Matplotlib figure instance

If ax is None, the created figure. Otherwise the figure to which ax is connected.

See also

matplotlib.pyplot.xcorr, matplotlib.pyplot.acorr, mpl_examples


Adapted from matplotlib’s xcorr.

Data are plotted as plot(lags, corr, **kwargs)