Using Pandas Autocorrelation Plot - how to limit x-axis to make it more readable?
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])
Alternatively, you can use the plot_acf()
function and specify the lags.
# import the plotting functions for act and pacf
from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
plot_acf(df1['Thousands of Passengers'], lags=40);