code: def lag_plot(series, lag=1, ax=None, **kwds):
      
      import matplotlib.pyplot as plt
  
      # workaround because `c='b'` is hardcoded in matplotlibs scatter method
      kwds.setdefault('c', plt.rcParams['patch.facecolor'])
  
      data = series.values
      y1 = data[:-lag]
      y2 = data[lag:]
      if ax is None:
          ax = plt.gca()
      ax.set_xlabel("y(t)")
      ax.set_ylabel("y(t + {lag})".format(lag=lag))
      ax.scatter(y1, y2, **kwds)
      return ax
docs: 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`