问题描述
如果我用matplotlib内联启动一个ipython笔记本,有没有办法随后绘制一个图形,以便以标准,非内联方式显示,而不必在没有内联命令的情况下重新加载笔记本?我希望能够将一些数字内联到笔记本中,但其他人在传统的交互模式中,我可以放大和平移。
If I start an ipython notebook with matplotlib inlined, is there a way to subsequently plot a figure so that it shows in the "standard", non-inlined, way, without having to reload the notebook without the inline command? I'd like to be able to have some figures inlined int he notebook, but others in the traditional interactive mode, where I can zoom and pan.
推荐答案
您可以通过%matplotlib< backend>
切换matplotlib的后端。要切换回系统的默认后端,请使用%matplotlib auto
或只是%matplotlib
。
You can switch the matplotlib's backend by %matplotlib <backend>
. To switch back to your system's default backend use %matplotlib auto
or just simply %matplotlib
.
有许多可用的后端,例如 gtk
, qt
,笔记本
等我个人强烈推荐笔记本
(又名 nbagg
)后端。它类似于内联
但是具有交互性,允许从Jupyter内部进行缩放/平移。
There are many backends available such as gtk
, qt
, notebook
, etc. I personally highly recommend the notebook
(a.k.a. nbagg
) backend. It is similar to inline
but interactive, allowing zooming/panning from inside Jupyter.
有关详细信息,请尝试:?%matplotlib
在IPython / Jupyter或
For more info try: ?%matplotlib
inside an IPython/Jupyter or IPython's online documentation
这篇关于matplotlib python内联开/关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!