使用 pandas 自相关图-如何限制x轴使其更具可读性? [英] Using Pandas Autocorrelation Plot - how to limit x-axis to make it more readable?
问题描述
我正在使用python 3.7.
I am using python 3.7.
我正在使用ARIMA模型进行时间序列预测.我正在使用自相关图评估ARIMA数据的属性,特别是使用pandas.plotting中的autocorrelation_plot.
I am performing time series forecasting using an ARIMA model. I am assessing the properties of my data for ARIMA using an Autocorrelation Plot - specifically using autocorrelation_plot from pandas.plotting.
我的数据有50,000条左右的记录,这使该图变得非常繁忙,很难找出任何特定趋势.有没有一种方法可以限制x轴以使前几百个滞后更加集中?
My data has 50,000 records or so, making the plot extremely busy and hard to pick out any specific trends. Is there a way to limit the x-axis to bring the first few hundred lags more into focus?
我不能分享实际的情节,但是我的代码如下:
I can't share the actual plot, but my code is as follow:
import pandas as pd
from pandas.plotting import autocorrelation_plot
#Import Data
time_series_2619 = pd.read_csv("Consumption/2619.csv", parse_dates=['Date/Time'], index_col = ['Date/Time'])['Recording']
#Auto Correlation Plot
autocorrelation_plot(time_series_2619)
我在文档中找不到任何内容.
I couldn't find anything in the documentation.
推荐答案
autocorrelation_plot
返回matplotlib.axis对象.因此,您可以简单地使用set_xlim()
方法来限制x轴:
autocorrelation_plot
returns a matplotlib.axis object. Hence, you can simply use the set_xlim()
method to limit the x-axis:
ax = autocorrelation_plot(time_series_2619)
ax.set_xlim([0, 500])
这篇关于使用 pandas 自相关图-如何限制x轴使其更具可读性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!