code: def lag_plot(data, lag=1, kind="scatter", **kwds):
      """Lag plot for time series.
  
      Parameters
      ----------
      data: pandas.Series
          the time series to plot
      lag: integer
          The lag of the scatter plot, default=1
      kind: string
          The kind of plot to use (e.g. 'scatter', 'line')
      **kwds:
          Additional keywords passed to data.vgplot.scatter
  
      Returns
      -------
      chart: alt.Chart object
      """
      if lag != int(lag) or int(lag) <= 0:
          raise ValueError("lag must be a positive integer")
      lag = int(lag)
  
      values = data.values
      y1 = "y(t)"
      y2 = "y(t + {0})".format(lag)
      lags = pd.DataFrame(
          {y1: values[:-lag].T.ravel(), y2: values[lag:].T.ravel()}
      )
  
      if isinstance(data, pd.DataFrame):
          lags["variable"] = np.repeat(
              data.columns, lags.shape[0] / data.shape[1]
          )
          kwds["c"] = "variable"
  
      return lags.vgplot(kind=kind, x=y1, y=y2, **kwds)
  
file_path: pdvega/pdvega/plotting.py
imports: import warnings
  import altair
  import numpy
  import pandas
  from ._utils import infer_vegalite_type
label_desc: Use image node_id 4 for calling a global function with example usage: lag_plot(data, lag, kind) and returns: lags