Lag Plot#
Lag plots help reveal autocorrelation in time series data by comparing each observation with a lagged version of itself. In this example, we use a synthetic sine wave signal with added noise to illustrate the concept.
import numpy as np
import pandas as pd
import hvplot.pandas # noqa
np.random.seed(1)
t = pd.date_range("2025-01-01", periods=200)
data = pd.Series(np.sin(np.linspace(0, 20, 200)) + np.random.normal(0, 0.2, 200), index=t)
hvplot.plotting.lag_plot(data)
import numpy as np
import pandas as pd
import hvplot.pandas # noqa
hvplot.extension("matplotlib")
np.random.seed(1)
t = pd.date_range("2025-01-01", periods=200)
data = pd.Series(np.sin(np.linspace(0, 20, 200)) + np.random.normal(0, 0.2, 200), index=t)
hvplot.plotting.lag_plot(data)
See also
This web page was generated from a Jupyter notebook and not all
interactivity will work on this website.