I know dot is not primarily a typesetting layout package, but I like it for the nice language and the nice drawings for some diagrams. I want to have better layout control. I understand rank=same, and it is very helpful, but I do not just want row control or column control (depending on rankdir), I really want more of both.
right now, I am struggling how to convince a basic tree diagram in LR rankdir to flip parts of the graph.
I am using C for column and R for row. I want to flip C2 and C3 not to go from bottom to top, but from top-to-bottom. the code I have been using is
digraph G {
rankdir="LR";
boxme [shape="box"]
start -> C1R1 ;
start -> C1R2 ;
C1R1 -> boxme ;
C1R1 -> C2R1 ;
boxme -> C2R2 ;
boxme -> C2R3 ;
subgraph cluster_0 {
label= "surrounded";
color=blue;
style=rounded; style=dashed; ## only last one takes
node [ style=filled, color=green ];
C3R1 -> C3R2 -> C3R3 -> C3R4 [style=invis];
{ rank = same; C3R1; C3R2; C3R3; C3R4; };
}
C2R1 -> C3R1 ;
C2R1 -> C3R2 ;
C2R2 -> C3R3 ;
C2R2 -> C3R4 ;
C2R3 -> C3R5 ;
C2R3 -> C3R6 ;
{ rank = same; C1R1; C1R2; }
{ rank = same; C2R1; C2R2; C2R3; }
# why does the following remove the surrounded box? (and algorithm crosses arrows)
# { rank = same; C3R1; C3R2; C3R3; C3R4; C3R5; C3R6; }
}
there is also the very strange layout (needlessly crossing arrows) when I uncomment out the final statement, and the dotted box no longer works.
by trial and error, I have figured out that the order in which statements appear can sometimes change the internaly dot layout algorithm, but I don’t understand how this works, either.
is dot entirely the wrong tool for what I want to do? or can it be coaxed appropriately with more layout control?
advice appreciated.
/iaw