Graphviz Selfloops重叠标签

时间:2015-06-05 12:25:55

标签: layout graphviz dot

我有一个简单的graphiz图,我试图用点渲染。它是单个状态下的一系列自循环:

digraph FST {
size = "8.5,11";
label = "";
rankdir=LR;
bgcolor = "transparent";
center = 1;
rank = same;
margin = 0;
orientation = Portrait;
0 [label = "0", shape = doublecircle, style = bold, fontsize = 14, color="#339933"]
    0 -> 0 [label = "a", fontsize = 14];
    0 -> 0 [label = "b", fontsize = 14];
    0 -> 0 [label = "cd", fontsize = 14];
    0 -> 0 [label = "efg", fontsize = 14];
    0 -> 0 [label = "a", fontsize = 14];
    0 -> 0 [label = "q", fontsize = 14];
    0 -> 0 [label = "xyzabc", fontsize = 14];
}

我编译如下:

 $ cat self-loop.dot | dot -Tpng > self-loop.png

然而,边缘与标签重叠并且看起来很荒谬。有没有办法防止边缘这样做?为了让它们更加耀眼?

Resulting Graph

我没有运气搜索论坛或graphviz文档。

1 个答案:

答案 0 :(得分:0)

多循环很痛苦。使用端口 (https://www.graphviz.org/doc/info/attrs.html#k:portPos) 会有所帮助。 Bur rankdir也有问题,所以我改了。

digraph FST {
size = "8.5,11";
label = "";
//rankdir=LR;  // note the change in rankdir!!
bgcolor = "transparent";
center = 1;
rank = same;
margin = 0;
orientation = Portrait;
0 [label = "0", shape = doublecircle, style = bold, fontsize = 14, color="#339933"]
    0:nw -> 0:ne [label = "a", fontsize = 14];
    0:nw -> 0:ne [label = "\nb", fontsize = 14];
    0:nw -> 0:ne [label = "\ncd", fontsize = 14];
    0:nw -> 0:ne [label = "\nefg  ", fontsize = 14];
    0:nw -> 0:ne [label = "  a  ", fontsize = 14];
    0:nw -> 0:ne [label = "  q  ", fontsize = 14];
    0:nw -> 0:ne [label = "xyzabc", fontsize = 14];
}

给予:
enter image description here