code: def test_lag_plot(lag):
      data = pd.DataFrame({"x": range(10), "y": range(10)})
  
      # test series input
      plot = pdvega.lag_plot(data["x"], lag=lag)
      lag_data = utils.get_data(plot)
  
      spec = plot.to_dict()
      assert spec["mark"] == "point"
      assert spec["encoding"]["x"]["type"] == "quantitative"
      assert spec["encoding"]["y"]["type"] == "quantitative"
  
      utils.check_encodings(plot, x="y(t)", y="y(t + {0})".format(lag))
      assert lag_data.shape == (data.shape[0] - lag, 2)
  
      # test dataframe input
      plot = pdvega.lag_plot(data, lag=lag)
      lag_data = utils.get_data(plot)
      spec = plot.to_dict()
  
      assert spec["mark"] == "point"
      assert spec["encoding"]["x"]["type"] == "quantitative"
      assert spec["encoding"]["y"]["type"] == "quantitative"
      assert spec["encoding"]["color"]["type"] == "nominal"
      utils.check_encodings(
          plot, x="y(t)", y="y(t + {0})".format(lag), color="variable"
      )
      assert lag_data.shape == (2 * (data.shape[0] - lag), 3)
  
file_path: pdvega/pdvega/tests/test_plotting.py
imports: import pytest
  import numpy
  import pandas
  import pdvega
  from pdvega.tests import utils
label_desc: Use image node_id 4 for calling a global function with example usage: test_lag_plot(lag) without return types