{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "import hvplot.pandas # noqa\n", "import numpy as np\n", "import pandas as pd" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Lag plots are most commonly used to look for patterns in time series data." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Given the following time series:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "np.random.seed(5)\n", "x = np.cumsum(np.random.normal(loc=1, scale=5, size=50))\n", "s = pd.Series(x, name='Time series')\n", "\n", "s.hvplot()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A lag plot with `lag=1` returns:" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "hvplot.plotting.lag_plot(s, lag=1)" ] } ], "metadata": { "language_info": { "name": "python", "pygments_lexer": "ipython3" } }, "nbformat": 4, "nbformat_minor": 5 }