IPython3 automatically config %matplotlib inline

大城市里の小女人 提交于 2020-01-01 06:42:06

问题


I'm using IPython 3 / Jupyter, and I want to use the %matplotlib option by default.

In IPython 2, I had the next option on the ~/.ipython/profile_default/ipython_notebook_config.py

c.InteractiveShellApp.matplotlib = 'inline'

But in IPython 3, this option is not available anymore.

It also disappeared the setting c.InlineBackend.rc, which I used to set up the appearance of charts.

How those options can be set now?


回答1:


Use the option in ~/.ipython/profile_default/ipython_kernel_config.py




回答2:


  1. Edit file ~/.ipython/profile_default/ipython_config.py

  2. Add line 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.




回答3:


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

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.

So in your case, you could try to execute the line '%matplotlib inline' at startup



来源:https://stackoverflow.com/questions/28964353/ipython3-automatically-config-matplotlib-inline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!