[graph-tool-tickets] [graph-tool] Ticket #89: Drawing vertices labels does not work

graph-tool webmaster at skewed.de
Tue Feb 21 13:49:28 UTC 2012

#89: Drawing vertices labels does not work
new defect
Reporter: wojciechwasko at gmail.com
Owner: tiago peixoto
Priority: normal
Milestone: (None)
I've been trying to add labels to nodes when drawing a graph. The documentation is not clear on that, however I guess it should be done through the `vpropos` attribute of the `graph_tool.draw.graph_draw` function.

This does not seem to work. Below, I attach the commands I used to create the plot, and the plot itself.

##### [12:54:17] # [dare2be at PC10CIS:~] #####
$ python
Python 2.7.2 (default, Oct 27 2011, 01:40:22) 
[GCC 4.6.1 20111003 (Red Hat 4.6.1-10)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import graph_tool.all as gt
>>> g = gt.Graph()
>>> v1 = g.add_vertex()
>>> v2 = g.add_vertex()
>>> e = g.add_edge(v1,v2)
>>> vprop_label = g.new_vertex_property("string")
>>> vprop_label[v1] = "vertex one"
>>> vprop_label[v2] = "vertex two"
>>> vprops = {'labels' : vprop_label}
>>> gt.graph_draw(g, vprops=vprops, output="out.pdf")
<PropertyMap object with key type 'Vertex' and value type 'vector<double>', for Graph 0x1e969d0, at 0x1e96a90>

Ticket URL: <URL:http://graph-tool.skewed.de/ticket/89>
graph-tool <URL:http://graph-tool.skewed.de/>
An efficient python module for graph analysis and manipulation.

More information about the graph-tool-tickets mailing list