[IPython-dev] IPython and matplotlib - Working with both inline plots and plots-in-a-window

Matthias BUSSONNIER bussonniermatthias at gmail.com
Sun Nov 24 09:53:21 EST 2013


Le 24 nov. 2013 à 15:34, Ronen Abravanel a écrit :

> Hello all,
> 
> I'm using IPython and matplotlib and like the fact that most of my plots are inline. But once in a while, I want to zoom into a plot, pan it a bit and so on.
> 
> Is there any way (on stable version of IPython \ matplotlib ) to replot a plot to a new window (\ different backend?)

%matlpotlib qt/osx/wx/inline...
allow to switch backend on recent enough version of both IPython and MPL.

With non inline backend gca()/ gcf() should grap and show the current graph inline. 
-- 
M


---
 %matplotlib [gui]

Set up matplotlib to work interactively.

This function lets you activate matplotlib interactive support
at any point during an IPython session.
It does not import anything into the interactive namespace.

If you are using the inline matplotlib backend for embedded figures,
you can adjust its behavior via the %config magic::

    # enable SVG figures, necessary for SVG+XHTML export in the qtconsole
    In [1]: %config InlineBackend.figure_format = 'svg'

    # change the behavior of closing all figures at the end of each
    # execution (cell), or allowing reuse of active figures across
    # cells:
    In [2]: %config InlineBackend.close_figures = False

Examples
--------
In this case, where the MPL default is TkAgg::

    In [2]: %matplotlib
    Using matplotlib backend: TkAgg

But you can explicitly request a different backend::

    In [3]: %matplotlib qt

positional arguments:
  gui  Name of the matplotlib backend to use ('gtk', 'inline', 'osx', 'qt',
       'qt4', 'tk', 'wx'). If given, the corresponding matplotlib backend is
       used, otherwise it will be matplotlib's default (which you can set in
       your matplotlib config file).





More information about the IPython-dev mailing list