All Courses

Automatically run %matplotlib inline in IPython Notebook

By Pritam Shinde, a year ago
  • Bookmark
0

Every time I launch IPython Notebook, the first command I run is

%matplotlib inline

Is there some way to change my config file so that when I launch IPython, it is automatically in this mode?

Python
Matlpotlib
Ipython
1 Answer
0

You can always start all your IPython kernels in inline mode by default by setting the following config options in your config files:

c.IPKernelApp.matplotlib=<CaselessStrEnum>
  Default: None
  Choices: ['auto', 'gtk', 'gtk3', 'inline', 'nbagg', 'notebook', 'osx', 'qt', 'qt4', 'qt5', 'tk', 'wx']
  Configure matplotlib for interactive use with the default matplotlib backend.


OR


IPython has profiles for configuration, located at ~/.ipython/profile_*. The default profile is called profile_default. Within this folder there are two primary configuration files:

  • ipython_config.py
  • ipython_kernel_config.py

Add the inline option for matplotlib to ipython_kernel_config.py:

c = get_config()
# ... Any other configurables you want to set
c.InteractiveShellApp.matplotlib = "inline"


Your Answer

Webinars

Why You Should Learn Data Science in 2022?

Dec 15th (7:00 PM) 277 Registered
More webinars

Related Discussions

Running random forest algorithm with one variable

View More