Statsmodels: `tsa.graphics.plot_acf` generates the graph twice when using on Jupyter notebook

Created on 7 Dec 2017  路  6Comments  路  Source: statsmodels/statsmodels

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)

Most helpful comment

Put semicolon at the end of your plot function to solve the problem.

All 6 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mustafaaydn picture mustafaaydn  路  4Comments

jseabold picture jseabold  路  4Comments

josef-pkt picture josef-pkt  路  5Comments

Freakwill picture Freakwill  路  5Comments

ChenChingChih picture ChenChingChih  路  3Comments