我想在IPython的笔记本内嵌绘制图形,但.plot()
methos只是显示对象的信息,大熊猫情节不IPython的笔记本电脑显示为在线
<matplotlib.axes._subplots.AxesSubplot at 0x10d8740d0>
,但没有图形。我也可以使它与plt.show()
显示图形,但我想要它内联。所以我尝试了%matplotlib inline
和ipython notebook --matplotlib=inline
,但它没有帮助。
如果我使用%matplotlib inline
,然后.plot()
显示
/Users/<username>/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/IPython/core/formatters.py:239:
FormatterWarning: Exception in image/png formatter: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128) FormatterWarning,
和使用ipython notebook --matplotlib=inline
显示相同。
认为我们将需要更多信息,显示您的代码,导入和平台... – dartdog 2015-02-07 17:23:32
使用'%matplotlib内联'时描述的错误是由于处理unicode和字符串的问题。可能你有用'latin-1'编码的字符,并且转换尝试使用'decode'。然而,'decode'会使用默认编码'ascii'将您的角色转换为unicode,并且由于该字符在ascii中找不到,转换将失败。你应该尝试使用解码将字符串转换为unicode('“\ xe2”)。解码(encoding ='latin-1')'),然后将该数据传递给matplotlib。 – 2015-02-07 19:52:16