Python StatsModels时间序列分解重复图

时间:2016-06-24 11:05:11

标签: python pandas matplotlib dataframe

我使用PandasStatsModels的混合来绘制时间序列分解。我跟着this answer,但是当我打电话给plot()时,它似乎正在绘制副本。

我的DataFrame看起来像

enter image description here

我的索引看起来像

enter image description here

但是当我绘制分解时,我得到了这个

enter image description here

奇怪的是,如果我只绘制分解的一个元素,则不会发生重复

enter image description here

1 个答案:

答案 0 :(得分:4)

.jar的结果分配给某些内容,例如res.plot()。 该方法的结果是fig = res.plot()。副本来自它的matplotlib.figure,笔记本呈现,因为它是单元格中的最后一项。您可以自己尝试

_repr_html_

第二种方法返回一个matplotlib fig, ax = plt.subplots() ax.plot([1, 2], [1, 2]) fig ,它没有axes所以你只看到图上方的文字。