Jupyter (IPython) 笔记本没有绘图
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31609600/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Jupyter (IPython) notebook not plotting
提问by Kapil Pau
I installed anaconda to use pandas and scipy. I reading and watching pandas tutorials and they all say to open the ipython notebook using
我安装了 anaconda 来使用 pandas 和 scipy。我阅读和观看熊猫教程,他们都说要使用打开 ipython 笔记本
ipython notebook --pylab==inline
but when I do that I get a message saying
但是当我这样做时,我收到一条消息说
"Support for specifying --pylab on the command line has been removed. Please use '%pylab = inline' or '%matplotlib =inline' in the notebook itself"
But that does not work. Then when I try "plot(arange(10))" I get a message saying "name 'plot' is not defined." I trying plotting data from a .csv file and got
但这不起作用。然后,当我尝试“plot(arange(10))”时,我收到一条消息,提示“名称‘plot’未定义。” 我尝试从 .csv 文件绘制数据并得到
"matplotlib.axes._subplots.AxesSubplot at 0xebf8b70".
What should I do?
我该怎么办?
回答by AZhao
I believe the pylab magic was removed when they transitioned from IPython to a more general Jupyter notebook.
我相信当他们从 IPython 过渡到更通用的 Jupyter 笔记本时,pylab 的魔力就被移除了。
Try:
尝试:
%matplotlib inline
Also when you get a message like:
此外,当您收到以下消息时:
"matplotlib.axes._subplots.AxesSubplot at 0xebf8b70".
That's just IPython displaying the object. You need to specify IPython display it. Hence the matplotlib inline magic.
那只是显示对象的 IPython。您需要指定 IPython 显示它。因此,matplotlib 内联魔法。