I am using a mixture of Pandas and StatsModels to plot a time series decomposition. I followed this answer but when I call plot() it seems to be plotting a duplicate.
My DataFrame looks like

My index looks like

but when I plot the decomposition I get this

Strangely, if I plot only an element of the decomposition, the duplication does not occur

Assign the result of res.plot() to something, e.g. fig = res.plot().
The result of that method is a matplotlib.figure. The duplicate is from it's _repr_html_, which the notebook renders since it's the last item in the cell. You can try it yourself with
fig, ax = plt.subplots()
ax.plot([1, 2], [1, 2])
fig
The second method returns a matplotlib axes, which doesn't have a _repr_html so you just see that text above the figure.
Adding plt.show() line after Solved the issue for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With