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.
相关问题
- How to plot a draggable polygon
- Access IPython's profile history (history.sqli
- Tick label text and frequency in matplotlib plot
- Matplotlib: how to set ticks of twinned axis in lo
- Matplotlib differentiate between mean and median w
相关文章
- How to use a framework build of Python with Anacon
- Adding line markers when using LineCollection
- How to add clipboard support to Matplotlib figures
- Adding a legend to a matplotlib boxplot with multi
- Matplotlib pyplot axes formatter
- cython in jupyter notebook
- python: ignoring leading “>>>” and “…” in interact
- matplotlib bwr-colormap, always centered on zero
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
.There are many backends available such as
gtk
,qt
,notebook
, etc. I personally highly recommend thenotebook
(a.k.a.nbagg
) backend. It is similar toinline
but interactive, allowing zooming/panning from inside Jupyter.For more info try:
?%matplotlib
inside an IPython/Jupyter or IPython's online documentationplt.ioff()
andplt.ion()
works like a charm in my Jupyter notebook with thenotebook
as backend (assuming the usualimport matplotlib.pyplot as plt
).It depends on the exact configuration of your matplotlib, but you can switch between inline and one of 'osx', 'qt4', 'qt5', 'gtk3', 'wx', 'qt', 'gtk', 'tk' (some are aliases of other). just use
%matplotlib <the one you want>
to switch. Depending on conditions you migh have only access to one of these.Another possibility is to use
matplotlib.pyplot.close(fig)
. This works for me even though%matplotlib auto
raises a horriblewx
error (related to the versions of the GTK development files I have installed inLD_LIBRARY_PATH
).While this might cause problems if you're doing something like making a video (or it might not; haven't tried), it worked for me when assembling images in a table using
IPython.display.HTML
per this answer.