prog/lib to draw graphs

netnews.upenn.edu p.magwene at snet.net
Thu Jan 22 07:48:27 EST 2004


Florian Lindner wrote:
> Hello,
> I'm looking for a program or python library to draw graphs.
> They should look like the that:
> 
> 
> /--------\                         /--------\
> | Node A | ------ belongs to ----> | Node B |
> \--------/                         \--------/
> 
> Which is a result of the function call like that:
> 
> connectNodes(firstNode, secondNode, description, lineStyle)
> connectNodes("Node A", "Node B", "belongs to", dashed)
> 
> It should have a open scalable vector format as output (DVI, SVG, PDF, ...)
> and should be able to make automatic optimal placement of the items.
> Do you know something like that?
> Thx,
> Florian

Try graphviz:

   http://www.research.att.com/sw/tools/graphviz/


I think there's a python interface to graphviz floating around (Google 
it), but it's  trivial to write a Python routine that spits out valid 
Graphviz "dot" files.

In the case of your example, the contents of the dot file would be 
something like:

digraph G{
     "Node A" -> "Node B" [label="belongs to"];
}


--Paul



More information about the Python-list mailing list