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 or scalar or None, optional) – 1-dimensional array of lag times with the same shape as data or the difference between the lag times or None. If None, lags is set to np.arange(len(data)). If a scalar, lags is set to np.arange(0, lags * len(data), lags).

  • siglev (scalar, optional) – The significance level of the confidence intervals, usually denoted as \(\alpha\). See mdtools.statistics.acf_confint() for more details.

  • kwargs_acf (dict or None, optional) – Dictionary of keyword arguments to parse to mdtools.statistics.acf_np(). See there for possible keyword arguments.

  • kwargs (dict, optional) – Keyword arguments to parse to matplotlib.axes.Axes.plot() and matplotlib.axes.Axes.fill_between() to change the appearance of the ACF. See there for possible keyword arguments.

Returns:

img (tuple) – A tuple of matplotlib.lines.Line2D and matplotlib.collections.PolyCollection objects containing the plotted data. The first element of img is a matplotlib.lines.Line2D object representing the ACF. The second element is a matplotlib.collections.PolyCollection containing the confidence intervals around the ACF. The third and fourth element of img are matplotlib.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