correlogram
- mdtools.plot.correlogram(ax, data, lags=None, siglev=0.05, kwargs_acf=None, **kwargs)[source]
Create a correlogram and plot it to the given
matplotlib.axes.Axes
.Create a correlogram for the given data similar to the one shown in the Wikipedia article Correlogram § Statistical inference with correlograms by calculating the autocorelation function (ACF) and its confidence intervals for the given data and plotting it to the given
matplotlib.axes.Axes
.- Parameters:
ax (
matplotlib.axes.Axes
) – The axes to draw to.data (
array_like
) – 1-dimensional array containing the data for which to calculate and plot the ACF.lags (
array_like
orscalar
orNone
, optional) – 1-dimensional array of lag times with the same shape as data or the difference between the lag times or None. IfNone
, lags is set tonp.arange(len(data))
. If a scalar, lags is set tonp.arange(0, lags * len(data), lags)
.siglev (
scalar
, optional) – The significance level of the confidence intervals, usually denoted as \(\alpha\). Seemdtools.statistics.acf_confint()
for more details.kwargs_acf (
dict
orNone
, optional) – Dictionary of keyword arguments to parse tomdtools.statistics.acf_np()
. See there for possible keyword arguments.kwargs (
dict
, optional) – Keyword arguments to parse tomatplotlib.axes.Axes.plot()
andmatplotlib.axes.Axes.fill_between()
to change the appearance of the ACF. See there for possible keyword arguments.
- Returns:
img (
tuple
) – A tuple ofmatplotlib.lines.Line2D
andmatplotlib.collections.PolyCollection
objects containing the plotted data. The first element of img is amatplotlib.lines.Line2D
object representing the ACF. The second element is amatplotlib.collections.PolyCollection
containing the confidence intervals around the ACF. The third and fourth element of img arematplotlib.lines.Line2D
objects representing the upper and lower bound of the confidence intervals around zero, respectively.
See also
mdtools.statistics.acf_np()
Calculate the autocorrelation function of a 1-dimensional array
mdtools.statistics.acf_confint()
Calculate the confidence intervals of an autocorrelation function