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?
jupyter-notebookmatplotlibpython
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?
Best Answer
The configuration way
IPython has profiles for configuration, located at
~/.ipython/profile_*
. The default profile is calledprofile_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
:matplotlib vs. pylab
Usage of
%pylab
to get inline plotting is discouraged.It introduces all sorts of gunk into your namespace that you just don't need.
%matplotlib
on the other hand enables inline plotting without injecting your namespace. You'll need to do explicit calls to get matplotlib and numpy imported.The small price of typing out your imports explicitly should be completely overcome by the fact that you now have reproducible code.