[英]IPython3 automatically config %matplotlib inline
I'm using IPython 3 / Jupyter, and I want to use the %matplotlib option by default. 我正在使用IPython 3 / Jupyter,我想默认使用%matplotlib选项。
In IPython 2, I had the next option on the ~/.ipython/profile_default/ipython_notebook_config.py 在IPython 2中,我在〜/ .ipython / profile_default / ipython_notebook_config.py上有下一个选项
c.InteractiveShellApp.matplotlib = 'inline'
But in IPython 3, this option is not available anymore. 但是在IPython 3中,此选项不再可用。
It also disappeared the setting c.InlineBackend.rc, which I used to set up the appearance of charts. 它也消失了设置c.InlineBackend.rc,我用它来设置图表的外观。
How those options can be set now? 现在如何设置这些选项?
使用~/.ipython/profile_default/ipython_kernel_config.py
Edit file ~/.ipython/profile_default/ipython_config.py
编辑文件
~/.ipython/profile_default/ipython_config.py
Add line c.InteractiveShellApp.matplotlib = 'inline'
添加行
c.InteractiveShellApp.matplotlib = 'inline'
You probably don't have this file, so you can create it with this command 您可能没有此文件,因此可以使用此命令创建它
echo "c.InteractiveShellApp.matplotlib = 'inline'" > ipython_config.py
Still works well, as of Apr 2017. 截至2017年4月,仍然运作良好。
Not sure if this works in your case, but you can give it a try: 不确定这是否适用于您的情况,但您可以尝试一下:
I am using a custom notebook theme according to this tutorial . 我根据本教程使用自定义笔记本主题。 Basically, I entered:
ipython profile create customcss
in a command-line and modified the custom.css file in ~/.ipython/profile_default/static/custom
基本上,我输入:
ipython profile create customcss
在命令行中ipython profile create customcss
并修改~/.ipython/profile_default/static/custom
的custom.css文件
Additionally i tried to get rid of my personalizations and imports in the first cell of every notebook by writing a file called 00_my_imports.py
in the folder ~/.ipython/profile_default/startup
. 另外,我试图通过在
~/.ipython/profile_default/startup
文件夹中写一个名为00_my_imports.py
的文件来摆脱每个笔记本的第一个单元格中的个性化和导入。
So in your case, you could try to execute the line '%matplotlib inline' at startup 因此,在您的情况下,您可以尝试在启动时执行'%matplotlib inline'行
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.