Enthought + PyCharm - 无法再显示图形
我在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>
。它没有显示图表,也没有其他任何反应。没有错误,也没有其他信息。
1 个回答
7
你缺少了调用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的交互模式。