In DiagrammeR
, I would like to pass a valid graph specification string in the DOT language to grViz()
that will force a straight edge from node a0 to a1 when there is a separate edge branching off to b0. b0 will be larger than a0 so how do I align a0 and b0 on the same rank where the top of b0 is level with the top of a0?
Current graph specification:
library(DiagrammeR)
grViz("
digraph G {
node [shape=box];
a0; a1;
b0[height=1,width=2];
node [shape = point, width = 0, height = 0];
y1;
a0 -> y1 [arrowhead=none];
y1 -> a1;
y1 -> b0;
{rank=same; a0; b0;}
}
")
Current output:
Desired output:
b0 is different size, so had to change to rankdir=LR to put b0 in its own (vertical) rank.
Then placed a0, a1 and y1 in their own rank
digraph G {
rankdir=LR // b0 is larger, so place in a different rank
node [shape=box];
{rank=same
a0; a1;
y1 [shape = point, width = 0, height = 0];
}
b0[height=1.5,width=2];
a0 -> y1 [arrowhead=none];
y1 -> a1;
y1 -> b0;
}