1

I need to generate a chart. I use pydot library. My code is:

import pydot
people = ['person_%d'%i for i in range(10)]
graph = pydot.Dot(graph_type='graph', rankdir='LR', splines='ortho')
# create nodes for people
node_list = [] 
for person in people:
    node = pydot.Node(person, shape="record", style="filled", fillcolor="#E8E8E8")
    node_list.append(node)
# get parent node
parent_node = node_list.pop(0)
# create edges
for node in node_list:
    edge = pydot.Edge(parent_node, node, color="#B6B6B6")
   graph.add_edge(edge)
graph.write_png('chart.png')

And the result of the executing this code is:

http://i49.tinypic.com/keu7mw.png

So what I need to change to have the same(similar) result as on the image below:

http://i48.tinypic.com/2115g0i.png

Adin
  • 101
  • 1
  • 4
  • From the documentation and sample images of pydot & graphviz it doesn't look like it generates the kind of graph you want. You might be able to fake it by creating dummy nodes, but I doubt it. – martineau Nov 14 '12 at 19:38
  • I have seen some comments about dummy nodes, but I thought that there is easier way to do it. – Adin Nov 15 '12 at 09:47

1 Answers1

0

I can't test it right now but does

edge = pydot.Edge(parent_node, node, color="#B6B6B6", splines="ortho")

work?

John
  • 13,197
  • 7
  • 51
  • 101