我正在尝试创建一个有固定位置节点的流程图。我使用不可见的节点来尝试强制边的方向。我的图表如下所示。
由于我希望从节点 d
出来的线条与从 c
到 d
的边缘是连续的(且直线),因此它还不太对。
请问我该如何使所有的线条都连接在一起呢?谢谢!
以下是我的代码:
digraph g1 {
graph [splines=false];
// invisible nodes
node[fontsize=15, shape = box, width=3, height=0] ;
i1 [ style="invis"];
i2 [ style="invis"];
i3 [ style="invis"];
i4 [ style="invis"];
node[fontsize=15, color = black, shape = box, width=3, height=1] ;
a[color=blue, label="a"];
b[color=green, label="b"];
c[color=orange, label="c"];
d[color=red, label="d"] ;
{rank=same; a -> b -> c};
{rankdir = TB; c -> i1[arrowhead=none];
i1 -> d[label=" FOR EACH\n\n"];
d -> i2[arrowhead=none];
};
{rank=same; i3 -> i2[arrowhead=none] };
{rankdir = TB;
b -> i4[style="invis"];
i4 -> i3[arrowhead=none];
};
{rank=same; i4 -> i1};
}
在保罗的评论下,我尝试使用node[fontsize=15, shape = box, label="", width=0, height=0, fixedsize=true]
,结果如下:
node[shape = box, width=0, height=0 fixedsize=true] ;
这样的东西来定义无形节点,但我现在无法尝试它。 - PaulR