How do I keep nodes in the desired position?

I'm having trouble arranging nodes into specific positions, and this is very important for what I'm trying to achieve. Dot decides to flip nodes around, placing them in really inconvenient arrangements that even end with arrows crossing over other nodes.

I've experimented with several different diagrams, but here's the simplest arrangement where I'm encountering my recurrent problem:

[graphviz, dot-example, png]

digraph G {

rankdir=LR; /* graph from left to right */
splines=ortho; /* arrows are straight and w 90 deg angles */
node [shape=box style=rounded fontsize=14 width=1.5 height=1 fixedsize=true font=ubuntu]

subgraph cluster1
a [label="Input"]
b [label="Do Stuff"]
a -> b
rank = same;
out [label="Output"]
a -> out [style=dotted shape=none arrowhead=none]
b -> out [tailport=s headport=e color=blue constraint=false]

The node labeled "input" is defined before the one labeled "output", however dot flips their positions around and places the "output on top". I need the "output" node to stay below and vertically aligned with the "input" node.
I defined both nodes as being in the same rank, that's the only way I found to align them vertically, perhaps there's a better way.


dot-example.png8.03 KB

This code is absolutely

This code is absolutely exact. I have been looking for the same thing but i could not define class on my own. It helps me in this regard.

nzonlinepokies spin palace casino

This is a quasi-bug: the

This is a quasi-bug: the sense of flat edges gets switched when occurring in clusters. (This is probably due to the code simply reversing a list when it processes a cluster, or something silly like that.) The workaround is to replace a->out with  

  out -> a  [style=dotted shape=none arrowhead=none]


Thanks Erg!! Your workaround

Thanks Erg!!

Your workaround worked perfectly :)

Recent comments