When using the function tsa.graphics.plot_acf on a Jupyter notebook, the graph is printed twice:
%matplotlib inline
import statsmodels.api as sm
import matplotlib.pyplot as plt
plt.style.set('ggplot')
# plots twice the same graph
sm.tsa.graphics.plot_acf(df, lags=48)
# plots only once
ax = sm.tsa.graphics.plot_acf(df, lags=48)
the duplicate plot display is a notebook "feature", not a bug
see #1265
(I reopened 1265 as FAQ issue because it took me some time to find the related issues.)
nothing we can or want to do about it.
Put semicolon at the end of your plot function to solve the problem.
@pirmoradian : thanks for your suggestion.
Or assign the output to a variable.
Thanks @bashtage
Put semicolon at the end of your plot function to solve the problem.
Amazing! Thanks @pirmoradian
Most helpful comment
Put semicolon at the end of your plot function to solve the problem.