You are reading documentation for the unreleased version of Matplotlib. Try searching for the released version of this page instead?
Applications are open for the 2018 John Hunter Matplotlib Summer Fellowship. Apply now!
Version 2.2.2.post1772+gd9240e24b
Fork me on GitHub

Related Topics

Cross- and Auto-Correlation DemoΒΆ

Example use of cross-correlation (xcorr) and auto-correlation (acorr) plots.

import matplotlib.pyplot as plt
import numpy as np

# Fixing random state for reproducibility

x, y = np.random.randn(2, 100)
fig, [ax1, ax2] = plt.subplots(2, 1, sharex=True)
ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, lw=2)
ax1.axhline(0, color='black', lw=2)

ax2.acorr(x, usevlines=True, normed=True, maxlags=50, lw=2)
ax2.axhline(0, color='black', lw=2)

Keywords: matplotlib code example, codex, python plot, pyplot Gallery generated by Sphinx-Gallery