gpt4 book ai didi

layout - Graphviz Selfloops 重叠标签

转载 作者:行者123 更新时间:2023-12-03 21:38:37 25 4
gpt4 key购买 nike

我有一个简单的 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文档。

最佳答案

多循环是一种痛苦。使用端口 ( 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

关于layout - Graphviz Selfloops 重叠标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30666546/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com