2017-03-06 10 views
1

私はJupyterコンソールを初めて試していますが、%matplotlib inlineのマジックを動作させることはできません。以下は、セッション例のスクリーンショットです:%matplotlib inlineはiPythonとJupyterコンソールでは動作しません

The window is a result of Line 6, and Line 7 didn't do anything at all. 私が6行目を実行した後、別のウィンドウにプロットが表示され、7行目は何もしません。私は%matplotlib --listを実行すると

inlineは、オプションの1つとして与えられている:私は別のバックエンドを使用しようとすると

Available matplotlib backends: ['osx', 'qt4', 'qt5', 'gtk3', 'notebook', 'wx', 'qt', 
'nbagg', 'agg', 'gtk', 'tk', 'ipympl', 'inline'] 

qt5言う私はQtがインストールされていないので、それはエラーメッセージを表示します。

ImportError: Matplotlib qt-based backends require an external PyQt4, PyQt5, or PySide 
package to be installed, but it was not found. 

%matplotlib??を実行すると、読み取ります

If you are using the inline matplotlib backend in the IPython Notebook 
     you can set which figure formats are enabled using the following:: 

      In [1]: from IPython.display import set_matplotlib_formats 

      In [2]: set_matplotlib_formats('pdf', 'svg') 

     The default for inline figures sets `bbox_inches` to 'tight'. This can 
     cause discrepancies between the displayed image and the identical 
     image created using `savefig`. This behavior can be disabled using the 
     `%config` magic:: 

      In [3]: %config InlineBackend.print_figure_kwargs = {'bbox_inches':None} 
をしかし、それは私が私の問題を解決するために周りに微調整することができるものかどうかはわかりません。

魔法のIPythonコンソールを試してみると、inlineUnknown Backendです。

UnknownBackend: No event loop integration for u'inline'. Supported event loops are: qt, 
qt4, qt5, gtk, gtk2, gtk3, tk, wx, pyglet, glut, osx 

私はまた、いくつかは、グーグルの後this issue on githubを見つけたが、私もそれは私の状況に関連していた場合(その会話のほとんどが笑私には意味がありませんでした)知りません。

最後に、この問題がまったく関連しているかどうかはわかりませんが、ちょうどその時です:私がJupyterで!vimコマンドでVimを開こうとすると、 Jupyter自体から端末を閉じることなく出てくる。しかし、VimはIPythonコンソールの中で呼び出されたときに完璧に動作します。

私はmatplotlib 2.0.0を使用しています。

誰かが私にこれを理解させる助けがあれば、それはすばらしいでしょう!ありがとうございました!

答えて

5

完全にテキストベースで、画像を表示できないコンソールを実行しています。したがって、inlineは利用可能ですが、インライン出力は生成されません。

私は、なぜそれが私の場合にはいた、しかし、エラーをスローしませんかわからない:

enter image description here

あなたはJupyter QTConsole

のように、GUIコンソールで %matplotlib inlineを使用することができます

enter image description here

またはブラウザでjupyterのノートブックで

enter image description here

+0

私が実際に試したときに同じエラーが発生しましたが、どうにかして回避できました。私は正確に何をしたのか覚えていない。とにかくそんなにありがとう、それはとても明白でしたが、なぜ私はそれを理解していないのかわかりません。 – spicypumpkin

-1

ipythonの古いバージョンを実行している場合は、代わりに%pylab inlineを試してください。 notes in this tutorial

関連する問題