def figure(num=None, figsize=None, dpi=None, facecolor=None, edgecolor=None, frameon=True, FigureClass=Figure, **kwargs):
 if (figsize is None):
  figsize = rcParams[u'figure.figsize']
 if (dpi is None):
  dpi = rcParams[u'figure.dpi']
 if (facecolor is None):
  facecolor = rcParams[u'figure.facecolor']
 if (edgecolor is None):
  edgecolor = rcParams[u'figure.edgecolor']
 allnums = get_fignums()
 next_num = ((max(allnums) + 1) if allnums else 1)
 figLabel = u''
 if (num is None):
  num = next_num
 elif is_string_like(num):
  figLabel = num
  allLabels = get_figlabels()
  if (figLabel not in allLabels):
   if (figLabel == u'all'):
    warnings.warn(u"close('all') closes all existing figures")
   num = next_num
  else:
   inum = allLabels.index(figLabel)
   num = allnums[inum]
 else:
  num = int(num)
 figManager = _pylab_helpers.Gcf.get_fig_manager(num)
 if (figManager is None):
  max_open_warning = rcParams[u'figure.max_open_warning']
  if ((max_open_warning >= 1) and (len(allnums) >= max_open_warning)):
   warnings.warn((u'More than %d figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).' % max_open_warning), RuntimeWarning)
  if (get_backend().lower() == u'ps'):
   dpi = 72
  figManager = new_figure_manager(num, figsize=figsize, dpi=dpi, facecolor=facecolor, edgecolor=edgecolor, frameon=frameon, FigureClass=FigureClass, **kwargs)
  if figLabel:
   figManager.set_window_title(figLabel)
   figManager.canvas.figure.set_label(figLabel)
  def make_active(event):
   _pylab_helpers.Gcf.set_active(figManager)
  cid = figManager.canvas.mpl_connect(u'button_press_event', make_active)
  figManager._cidgcf = cid
  _pylab_helpers.Gcf.set_active(figManager)
  fig = figManager.canvas.figure
  fig.number = num
  if matplotlib.is_interactive():
   draw_if_interactive()
  if _INSTALL_FIG_OBSERVER:
   fig.stale_callback = _auto_draw_if_interactive
 return figManager.canvas.figure

def figure ( num = None , figsize = None , dpi = None , facecolor = None , edgecolor = None , frameon = True , FigureClass = Figure , ** kwargs ) : if ( figsize is None ) : figsize = rcParams [ u'figure.figsize' ] if ( dpi is None ) : dpi = rcParams [ u'figure.dpi' ] if ( facecolor is None ) : facecolor = rcParams [ u'figure.facecolor' ] if ( edgecolor is None ) : edgecolor = rcParams [ u'figure.edgecolor' ] allnums = get_fignums ( ) next_num = ( ( max ( allnums ) + 1 ) if allnums else 1 ) figLabel = u'' if ( num is None ) : num = next_num elif is_string_like ( num ) : figLabel = num allLabels = get_figlabels ( ) if ( figLabel not in allLabels ) : if ( figLabel == u'all' ) : warnings . warn ( u"close('all') closes all existing figures" ) num = next_num else : inum = allLabels . index ( figLabel ) num = allnums [ inum ] else : num = int ( num ) figManager = _pylab_helpers . Gcf . get_fig_manager ( num ) if ( figManager is None ) : max_open_warning = rcParams [ u'figure.max_open_warning' ] if ( ( max_open_warning >= 1 ) and ( len ( allnums ) >= max_open_warning ) ) : warnings . warn ( ( u'More than %d figures have been opened. Figures created through the pyplot interface (`matplotlib.pyplot.figure`) are retained until explicitly closed and may consume too much memory. (To control this warning, see the rcParam `figure.max_open_warning`).' % max_open_warning ) , RuntimeWarning ) if ( get_backend ( ) . lower ( ) == u'ps' ) : dpi = 72 figManager = new_figure_manager ( num , figsize = figsize , dpi = dpi , facecolor = facecolor , edgecolor = edgecolor , frameon = frameon , FigureClass = FigureClass , ** kwargs ) if figLabel : figManager . set_window_title ( figLabel ) figManager . canvas . figure . set_label ( figLabel ) def make_active ( event ) : _pylab_helpers . Gcf . set_active ( figManager ) cid = figManager . canvas . mpl_connect ( u'button_press_event' , make_active ) figManager . _cidgcf = cid _pylab_helpers . Gcf . set_active ( figManager ) fig = figManager . canvas . figure fig . number = num if matplotlib . is_interactive ( ) : draw_if_interactive ( ) if _INSTALL_FIG_OBSERVER : fig . stale_callback = _auto_draw_if_interactive return figManager . canvas . figure
create a new :class:~bokeh .