How to make IPython notebook matplotlib plot inline How to make IPython notebook matplotlib plot inline python python

How to make IPython notebook matplotlib plot inline


I used %matplotlib inline in the first cell of the notebook and it works. I think you should try:

%matplotlib inlineimport matplotlibimport numpy as npimport matplotlib.pyplot as plt

You can also 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.


If your matplotlib version is above 1.4, it is also possible to use

IPython 3.x and above

%matplotlib notebookimport matplotlib.pyplot as plt

older versions

%matplotlib nbaggimport matplotlib.pyplot as plt

Both will activate the nbagg backend, which enables interactivity.

Example plot with the nbagg backend