def figure(num=None, <EOL>figsize   = None, <EOL>dpi       = None, <EOL>facecolor = None, <EOL>edgecolor = None, <EOL>frameon = True,<EOL>FigureClass = Figure,<EOL>**kwargs<EOL>):
if figsize is None   : figsize   = rcParams['<STR_LIT>']<EOL>if dpi is None       : dpi       = rcParams['<STR_LIT>']<EOL>if facecolor is None : facecolor = rcParams['<STR_LIT>']<EOL>if edgecolor is None : edgecolor = rcParams['<STR_LIT>']<EOL>if num is None:<EOL><INDENT>allnums = [f.num for f in _pylab_helpers.Gcf.get_all_fig_managers()]<EOL>if allnums:<EOL><INDENT>num = max(allnums) + <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>num = <NUM_LIT:1><EOL><DEDENT><DEDENT>else:<EOL><INDENT>num = int(num)  <EOL><DEDENT>figManager = _pylab_helpers.Gcf.get_fig_manager(num)<EOL>if figManager is None:<EOL><INDENT>if get_backend().lower() == '<STR_LIT>':  dpi = <NUM_LIT><EOL>figManager = new_figure_manager(num, figsize=figsize,<EOL>dpi=dpi,<EOL>facecolor=facecolor,<EOL>edgecolor=edgecolor,<EOL>frameon=frameon,<EOL>FigureClass=FigureClass,<EOL>**kwargs)<EOL>def make_active(event):<EOL><INDENT>_pylab_helpers.Gcf.set_active(figManager)<EOL><DEDENT>cid = figManager.canvas.mpl_connect('<STR_LIT>', make_active)<EOL>figManager._cidgcf = cid<EOL>_pylab_helpers.Gcf.set_active(figManager)<EOL>figManager.canvas.figure.number = num<EOL><DEDENT>draw_if_interactive()<EOL>return figManager.canvas.figure<EOL>
call signature::

  figure(num=None, figsize=(8, 6), dpi=80, facecolor='w', edgecolor='k')


Create a new figure and return a :class:`matplotlib.figure.Figure`
instance.  If *num* = *None*, the figure number will be incremented and
a new figure will be created.  The returned figure objects have a
*number* attribute holding this number.

If *num* is an integer, and ``figure(num)`` already exists, make it
active and return the handle to it.  If ``figure(num)`` does not exist
it will be created.  Numbering starts at 1, matlab style::

  figure(1)

If you are creating many figures, make sure you explicitly call "close"
on the figures you are not using, because this will enable pylab
to properly clean up the memory.

Optional keyword arguments:

  =========   =======================================================
  Keyword     Description
  =========   =======================================================
  figsize     width x height in inches; defaults to rc figure.figsize
  dpi         resolution; defaults to rc figure.dpi
  facecolor   the background color; defaults to rc figure.facecolor
  edgecolor   the border color; defaults to rc figure.edgecolor
  =========   =======================================================

rcParams defines the default values, which can be modified in the
matplotlibrc file

*FigureClass* is a :class:`~matplotlib.figure.Figure` or derived
class that will be passed on to :meth:`new_figure_manager` in the
backends which allows you to hook custom Figure classes into the
pylab interface.  Additional kwargs will be passed on to your
figure init function.