lib.pylabtools — IPython 0.11 documentation

### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »

# lib.pylabtools

## Module: `lib.pylabtools`

Pylab (matplotlib) support utilities.

### Authors

- Fernando Perez.
- Brian Granger

## Functions

`IPython.lib.pylabtools.` `activate_matplotlib`(backend)

  Activate the given backend and set interactive to True.

`IPython.lib.pylabtools.` `figsize`(sizex, sizey)

  Set the default figure size to be [sizex, sizey].

  This is just an easy to remember, convenience wrapper that sets:

      matplotlib.rcParams['figure.figsize'] = [sizex, sizey]

`IPython.lib.pylabtools.` `find_gui_and_backend`(gui=None)

  Given a gui string return the gui and mpl backend.

  Parameters : | gui : str Can be one of (‘tk’,’gtk’,’wx’,’qt’,’qt4’,’inline’).
  Returns : | A tuple of (gui, backend) where backend is one of (‘TkAgg’,’GTKAgg’, : ‘WXAgg’,’Qt4Agg’,’module://IPython.zmq.pylab.backend_inline’). :

`IPython.lib.pylabtools.` `getfigs`(*fig_nums)

  Get a list of matplotlib figures by figure numbers.

  If no arguments are given, all available figures are returned. If the argument list contains references to invalid figures, a warning is printed but the function continues pasting further figures.

  Parameters : | figs : tuple A tuple of ints giving the figure numbers of the figures to return.

`IPython.lib.pylabtools.` `import_pylab`(user_ns, backend, import_all=True, shell=None)

  Import the standard pylab symbols into user_ns.

`IPython.lib.pylabtools.` `mpl_runner`(safe_execfile)

  Factory to return a matplotlib-enabled runner for %run.

  Parameters : | safe_execfile : function This must be a function with the same interface as the `safe_execfile()` method of IPython.
  Returns : | A function suitable for use as the ``runner`` argument of the %run magic : function. :

`IPython.lib.pylabtools.` `print_figure`(fig, fmt='png')

  Convert a figure to svg or png for inline display.

`IPython.lib.pylabtools.` `pylab_activate`(user_ns, gui=None, import_all=True)

  Activate pylab mode in the user’s namespace.

  Loads and initializes numpy, matplotlib and friends for interactive use.

  Parameters : | user_ns : dict Namespace where the imports will occur. gui : optional, string A valid gui name following the conventions of the %gui magic. import_all : optional, boolean If true, an ‘import *‘ is done from numpy and pylab.
  Returns : | The actual gui used (if not given as input, it was obtained from matplotlib : itself, and will be needed next to configure IPython’s gui integration. :

`IPython.lib.pylabtools.` `select_figure_format`(shell, fmt)

  Select figure format for inline backend, either ‘png’ or ‘svg’.

  Using this method ensures only one figure format is active at a time.

### Navigation

- index
- modules |
- next |
- previous |
- home|
- search|
- documentation »
- The IPython API »