snippetpythonCritical
How to make IPython notebook matplotlib plot inline
Viewed 0 times
matplotlibhowinlinemakeplotnotebookipython
Problem
I am trying to use IPython notebook on MacOS X with Python 2.7.2 and IPython 1.1.0.
I cannot get matplotlib graphics to show up inline.
I have also tried
Instead of inline graphics, I get this:
And
I cannot get matplotlib graphics to show up inline.
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inlineI have also tried
%pylab inline and the ipython command line arguments --pylab=inline but this makes no difference.x = np.linspace(0, 3*np.pi, 500)
plt.plot(x, np.sin(x**2))
plt.title('A simple chirp')
plt.show()Instead of inline graphics, I get this:
And
matplotlib.get_backend() shows that I have the 'module://IPython.kernel.zmq.pylab.backend_inline' backend.Solution
I used
You can also always start all your IPython kernels in inline mode by default by setting the following config options in your config files:
%matplotlib inline in the first cell of the notebook and it works. I think you should try:%matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as pltYou 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=
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.Code Snippets
%matplotlib inline
import matplotlib
import numpy as np
import matplotlib.pyplot as pltc.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.Context
Stack Overflow Q#19410042, score: 1238
Revisions (0)
No revisions yet.