Jupyter(IPython)笔记本无法绘图。

51

我安装了Anaconda来使用Pandas和Scipy。我正在阅读和观看有关Pandas的教程,他们都说要使用以下方法打开ipython笔记本:

 ipython notebook --pylab==inline

但是当我这样做时,会收到一条消息:

"Support for specifying --pylab on the command line has been removed. Please use '%pylab = inline' or '%matplotlib =inline' in the notebook itself"

但是那样不起作用。当我尝试使用“plot(arange(10))”时,会收到一条消息,提示“名称'plot'未定义”。我试图绘制来自.csv文件的数据并得到了

"matplotlib.axes._subplots.AxesSubplot at 0xebf8b70".

我该怎么办?


4
在笔记本中尝试使用%matplotlib inline(注意没有等号符号)。 - Chinmay Kanchi
请尝试按照以下指示操作:https://dev59.com/FmIk5IYBdhLWcg3wTccr - JohnE
1个回答

125

我认为当他们从IPython转移到更通用的Jupyter笔记本时,pylab魔法函数被删除了。

尝试:

%matplotlib inline

当你收到以下信息时:

"matplotlib.axes._subplots.AxesSubplot at 0xebf8b70".

这只是IPython显示对象,您需要指定IPython显示它。因此需要使用matplotlib inline魔法命令。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接