def mark_plot_labels(app, document):
 for (name, explicit) in document.nametypes.iteritems():
  if (not explicit):
   continue
  labelid = document.nameids[name]
  if (labelid is None):
   continue
  node = document.ids[labelid]
  if (node.tagname in ('html_only', 'latex_only')):
   for n in node:
    if (n.tagname == 'figure'):
     sectname = name
     for c in n:
      if (c.tagname == 'caption'):
       sectname = c.astext()
       break
     node['ids'].remove(labelid)
     node['names'].remove(name)
     n['ids'].append(labelid)
     n['names'].append(name)
     document.settings.env.labels[name] = (document.settings.env.docname, labelid, sectname)
     break

def mark_plot_labels ( app , document ) : for ( name , explicit ) in document . nametypes . iteritems ( ) : if ( not explicit ) : continue labelid = document . nameids [ name ] if ( labelid is None ) : continue node = document . ids [ labelid ] if ( node . tagname in ( 'html_only' , 'latex_only' ) ) : for n in node : if ( n . tagname == 'figure' ) : sectname = name for c in n : if ( c . tagname == 'caption' ) : sectname = c . astext ( ) break node [ 'ids' ] . remove ( labelid ) node [ 'names' ] . remove ( name ) n [ 'ids' ] . append ( labelid ) n [ 'names' ] . append ( name ) document . settings . env . labels [ name ] = ( document . settings . env . docname , labelid , sectname ) break
to make plots referenceable .