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.
import matplotlib
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
I 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:
<matplotlib.figure.Figure at 0x110b9c450>
And matplotlib.get_backend()
shows that I have the 'module://IPython.kernel.zmq.pylab.backend_inline'
backend.
<matplotlib.figure.Figure at 0x110b9c450>
but<matplotlib.text.Text at 0x94f9320>
(because your last line is printing a title). Anyway, your code (with %matplotlib inline and plt.show()) works as expected on windows%matplotlib inline
, the kernel stays busy permanently and I get no output. It has to be killed. This is trying to use theMacOSX
backend but I guess it cannot be opened for some reason. When not using ipython notebook, the MacOSX backend for matplotlib works just fine.