A **lag plot** is a scatter plot for a time series and the same data lagged. With such a plot, we can check whether there is a possible correlation between CPU transistor counts this year and the previous year, for instance. The `lag_plot()`

pandas function in `pandas.tools.plotting`

can draw a lag plot. Draw a lag plot with the default lag of `1`

for the CPU transistor counts, as follows:

lag_plot(np.log(df['trans_count']))

Refer to the following plot for the end result:

The following code for the lag plot example can also be found in the `lag_plot.py`

file in this book's code bundle:

import matplotlib.pyplot as plt import numpy as np import pandas as ...

Start Free Trial

No credit card required