4

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?

3 Answers 3

7

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

Sign up to request clarification or add additional context in comments.

4 Comments

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.
Please stop changing ipython_kernel_config to ipython_config, the second one also apply for the pure terminal interpreter where inline will not work. I do mean ipython_kernel_config.
Note that you might need to create a new profile if you're upgrading from IPython 2 - the ipython_kernel_config.py file is apparently new in IPython 3.
Still a working solution for python 3.6.5 and Jupyter QtConsole 4.3.1
1
  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.

2 Comments

This does work for automatically setting up inline plotting in the IPython Qt console, but running IPython in a terminal produces an error message: [TerminalIPythonApp] WARNING | GUI event loop or pylab initialization failed UsageError: Invalid GUI request 'inline', valid ones are: pyglet, gtk3, qt, tk, wx, osx, qt5, gtk, glut
it works if you run ipython notebook (You do get the message when running ipython, but that does not start Jupyter)
-1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.