matplotlib 3.5.1

NotesOther ParametersParametersReturns
xcorr(self, x, y, normed=True, detrend=<function detrend_none at 0x0000000>, usevlines=True, maxlags=10, *, data=None, **kwargs)

The correlation with lag k is defined as $\sum_n x[n+k] \cdot y^*[n]$ , where $y^*$ is the complex conjugate of $y$ .

Notes

The cross correlation is performed with numpy.correlate with mode = "full" .

Other Parameters

linestyle : `.Line2D` property, optional

The linestyle for plotting the data points. Only used if usevlines is False .

marker : str, default: 'o'

The marker for plotting the data points. Only used if usevlines is False .

data : indexable object, optional

If given, the following parameters also accept a string s , which is interpreted as data[s] (unless this raises an exception):

x, y

**kwargs :

Additional parameters are passed to .Axes.vlines and .Axes.axhline if usevlines is True ; otherwise they are passed to .Axes.plot .

Parameters

x, y : array-like of length n
detrend : callable, default: `.mlab.detrend_none` (no detrending)

A detrending function applied to x and y. It must have the signature :

detrend(x: np.ndarray) -> np.ndarray
normed : bool, default: True

If True , input vectors are normalised to unit length.

usevlines : bool, default: True

Determines the plot style.

If True , vertical lines are plotted from 0 to the xcorr value using .Axes.vlines . Additionally, a horizontal line is plotted at y=0 using .Axes.axhline .

If False , markers are plotted at the xcorr values using .Axes.plot .

maxlags : int, default: 10

Number of lags to show. If None, will return all 2 * len(x) - 1 lags.

Returns

lags : array (length ``2*maxlags+1``)

The lag vector.

c : array (length ``2*maxlags+1``)

The auto correlation vector.

line : `.LineCollection` or `.Line2D`

.Artist added to the Axes of the correlation:

b : `.Line2D` or None

Horizontal line at 0 if usevlines is True None usevlines is False.

Plot the cross correlation between x and y.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/axes/_axes.py#1939
type: <class 'function'>
Commit: