def lag_plot(series, lag=<NUM_LIT:1>, ax=None, **kwds):
import matplotlib.pyplot as plt<EOL>kwds.setdefault('<STR_LIT:c>', plt.rcParams['<STR_LIT>'])<EOL>data = series.values<EOL>y1 = data[:-lag]<EOL>y2 = data[lag:]<EOL>if ax is None:<EOL><INDENT>ax = plt.gca()<EOL><DEDENT>ax.set_xlabel("<STR_LIT>")<EOL>ax.set_ylabel("<STR_LIT>".format(lag=lag))<EOL>ax.scatter(y1, y2, **kwds)<EOL>return ax<EOL>
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, optional

    Returns
    -------
    class:`matplotlib.axis.Axes`