【问题标题】:Enthought + PyCharm - cannot show plots anymoreEnthought + PyCharm - 不能再显示图了
【发布时间】:2014-04-04 07:31:25
【问题描述】:

我在 Mac OS X PyCharm 上将 Enthought 设置为解释器:

~/Library/Enthought/Canopy_64bit/User

但是,它没有显示任何来自 matplotlib 的图。

import pandas as pd
from numpy import *
import matplotlib.pyplot as plt
ts = pd.Series(random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
ts = ts.cumsum()
ts.plot()

这只是给了我Out[124]: <matplotlib.axes.AxesSubplot at 0x10dd29f90>。它不显示情节,也不做任何其他事情。没有错误,什么都没有。

【问题讨论】:

    标签: python plot pycharm enthought


    【解决方案1】:

    您缺少对显示绘图项的 show() 函数的调用。

    import pandas as pd
    from numpy import *
    import matplotlib.pyplot as plt
    ts = pd.Series(random.randn(1000), index=pd.date_range('1/1/2000', periods=1000))
    ts = ts.cumsum()
    ts.plot()
    plt.show()
    

    PyCharm 很可能未配置为与 matplotlib 交互模式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2023-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-10-19
      • 2014-09-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多