I am trying to use IPython notebook on MacOS X with Python 2.7.2 and IPython 1.1.0.
(我正在MacOS X上使用Python 2.7.2和IPython 1.1.0的情况下使用IPython Notebook。)
I cannot get matplotlib graphics to show up inline.
(我无法获得matplotlib图形来内联显示。)
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.
(我也尝试了%pylab inline
和ipython命令行参数--pylab=inline
但这没什么区别。)
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.get_backend()
表明我有'module://IPython.kernel.zmq.pylab.backend_inline'
后端。)
ask by Ian Fiske translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…