I am using graphviz, however i woudl like to force the node "This on top" to the top of the page, and not side on. This is the graph:
This is the code:
g= Digraph('trial', filename='trial.gv')
g.attr(compound='true', rankdir="TB" )
with g.subgraph() as s:
s.attr(rank='max')
s.node('This on top ')
s.edge('this right under', "Fabrication")
with g.subgraph(name='cluster0') as c:
c.node("This")
c.node("that")
c.node("and this on the same level")
g.edge("this right under","that", lhead="cluster0" )
g.edge("that","This on top ", ltail="cluster0" )
g
Is there a command to make sure that Nodes are displayed in the TOP/Bottom order i wish?
The first problem is that setting
rank='max'
is forcing everything in the first subgraph to go to the maximum rank, which is the lowest rank. You might have meant to setrank='min'
which would place the items in the subgraph at the highest rank, but that still wouldn't create the arrangement you want.Instead, you can use an invisible edge by setting
style = 'invis'
when creating the edge to force "This on top" to come before "this right under".Which produces: