Autocorrelation

plot 06 acorr

Live figure — pick a tool, then zoom, pan, point-pick or annotate. Nothing is active until a tool is selected.

View this figure’s Vega export ↗ — the raw JSON spec, rendered live by a real Vega engine.

View this figure’s Vega-Lite export ↗ — the raw JSON spec(s), rendered live by a real Vega-Lite engine.

import numpy as np
import plotpress

rng = np.random.default_rng(3)
# AR(1) process: neighbouring samples correlate, so acorr decays with lag
x = np.zeros(600)
for i in range(1, x.size):
    x[i] = 0.8 * x[i - 1] + rng.standard_normal()

fig, ax = plotpress.subplots()
ax.acorr(x, maxlags=40, color="C0")
ax.set_title("acorr"); ax.set_xlabel("lag")

Total running time of the script: (0 minutes 0.075 seconds)

Gallery generated by Sphinx-Gallery