pandas.plotting.lag_plot
- pandas.plotting. lag_plot ( series, lag=1, ax=None, **kwds ) [source]
-
Lag plot for time series.
- Parameters
-
- series :Time series
- lag :lag of the scatter plot, default 1
- ax :Matplotlib axis object, optional
- **kwds
-
Matplotlib scatter method keyword arguments.
- Returns
-
- class: matplotlib.axis.Axes
Examples
Lag plots are most commonly used to look for patterns in time series data.
Given the following time series
>>> np.random.seed(5) >>> x = np.cumsum(np.random.normal(loc=1, scale=5, size=50)) >>> s = pd.Series(x) >>> s.plot() <AxesSubplot:xlabel='Midrange'>
A lag plot with
lag=1
returns>>> pd.plotting.lag_plot(s, lag=1) <AxesSubplot:xlabel='y(t)', ylabel='y(t + 1)'>
© 2008–2022, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.4.0/reference/api/pandas.plotting.lag_plot.html