當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python pandas.plotting.lag_plot用法及代碼示例

用法:

pandas.plotting.lag_plot(series, lag=1, ax=None, **kwds)

時間序列的滯後圖。

參數

series時間序列
lag散點圖的滯後,默認1
axMatplotlib 軸對象,可選
**kwds

Matplotlib scatter 方法關鍵字參數。

返回

類:matplotlib.axis.Axes

例子

滯後圖最常用於尋找時間序列數據中的模式。

給定以下時間序列

>>> np.random.seed(5)
>>> x = np.cumsum(np.random.normal(loc=1, scale=5, size=50))
>>> s = pd.Series(x)
>>> s.plot()
<AxesSubplot:xlabel='Midrange'>
pandas-plotting-lag_plot-1.png

帶有lag=1 的滯後圖返回

>>> pd.plotting.lag_plot(s, lag=1)
<AxesSubplot:xlabel='y(t)', ylabel='y(t + 1)'>
pandas-plotting-lag_plot-2.png

相關用法


注:本文由純淨天空篩選整理自pandas.pydata.org大神的英文原創作品 pandas.plotting.lag_plot。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。