‘rankdir=LR’ 在dot语言中不起作用。

huangapple go评论56阅读模式
英文:

'rankdir=LR' does not work in dot language

问题

我有以下的dot代码:

digraph FST {
rankdir = "LR";
size = "8.5,11";
label = "";
center = 1;
orientation = Landscape;
ranksep = "0.4";
nodesep = "0.25";
0 [label = "0", shape = circle, style = bold, fontsize = 14]
    0 -> 1 [label = "<eps>:<eps>/0.69315", fontsize = 14];
    0 -> 2 [label = "<eps>:<eps>/0.69315", fontsize = 14];
1 [label = "1", shape = doublecircle, style = solid, fontsize = 14]
    1 -> 3 [label = "ae1:abbey", fontsize = 14];
    1 -> 5 [label = "b:bare", fontsize = 14];
    1 -> 1 [label = "sil:'SIL/0.69315", fontsize = 14];
    1 -> 2 [label = "sil:'SIL/0.69315", fontsize = 14];
2 [label = "2", shape = circle, style = solid, fontsize = 14]
    2 -> 1 [label = "sil:<eps>", fontsize = 14];
3 [label = "3", shape = circle, style = solid, fontsize = 14]
    3 -> 4 [label = "b:<eps>", fontsize = 14];
4 [label = "4", shape = circle, style = solid, fontsize = 14]
    4 -> 1 [label = "iy0:<eps>/0.69315", fontsize = 14];
    4 -> 2 [label = "iy0:<eps>/0.69315", fontsize = 14];
5 [label = "5", shape = circle, style = solid, fontsize = 14]
    5 -> 6 [label = "eh1:<eps>", fontsize = 14];
6 [label = "6", shape = circle, style = solid, fontsize = 14]
    6 -> 1 [label = "r:<eps>/0.69315", fontsize = 14];
    6 -> 2 [label = "r:<eps>/0.69315", fontsize = 14];
}

然而,当我使用以下命令将上面的代码转换为SVG时,我得到了一个错误的图像,如下所示:

cat a.dot | dot -Tsvg > a.svg

以下是我期望的结果:

‘rankdir=LR’ 在dot语言中不起作用。

正如您所看到的,我已经使用LR作为rankdir。

rankdir = "LR";

我的问题是如何获得第二个图像?

我通过Google搜索,未能获得任何有用的信息。我已经尝试的包括:

  1. 通过conda重新安装到7.1.0版本的Graphviz(但仍无法获得期望的图像)。
  2. 通过yum重新安装Graphviz到7.1.0版本(未能安装成功)。
  3. 尝试其他rankdir(不起作用)。
  4. 尝试通过dot将其转换为SVG、PNG、PS格式(不起作用)。

希望您能提供一些建议,以便我获得预期的图像。

英文:

I have the following dot code

digraph FST {
rankdir = &quot;LR&quot;;
size = &quot;8.5,11&quot;;
label = &quot;&quot;;
center = 1;
orientation = Landscape;
ranksep = &quot;0.4&quot;;
nodesep = &quot;0.25&quot;;
0 [label = &quot;0&quot;, shape = circle, style = bold, fontsize = 14]
    0 -&gt; 1 [label = &quot;&lt;eps&gt;:&lt;eps&gt;/0.69315&quot;, fontsize = 14];
    0 -&gt; 2 [label = &quot;&lt;eps&gt;:&lt;eps&gt;/0.69315&quot;, fontsize = 14];
1 [label = &quot;1&quot;, shape = doublecircle, style = solid, fontsize = 14]
    1 -&gt; 3 [label = &quot;ae1:abbey&quot;, fontsize = 14];
    1 -&gt; 5 [label = &quot;b:bare&quot;, fontsize = 14];
    1 -&gt; 1 [label = &quot;sil:&#39;SIL/0.69315&quot;, fontsize = 14];
    1 -&gt; 2 [label = &quot;sil:&#39;SIL/0.69315&quot;, fontsize = 14];
2 [label = &quot;2&quot;, shape = circle, style = solid, fontsize = 14]
    2 -&gt; 1 [label = &quot;sil:&lt;eps&gt;&quot;, fontsize = 14];
3 [label = &quot;3&quot;, shape = circle, style = solid, fontsize = 14]
    3 -&gt; 4 [label = &quot;b:&lt;eps&gt;&quot;, fontsize = 14];
4 [label = &quot;4&quot;, shape = circle, style = solid, fontsize = 14]
    4 -&gt; 1 [label = &quot;iy0:&lt;eps&gt;/0.69315&quot;, fontsize = 14];
    4 -&gt; 2 [label = &quot;iy0:&lt;eps&gt;/0.69315&quot;, fontsize = 14];
5 [label = &quot;5&quot;, shape = circle, style = solid, fontsize = 14]
    5 -&gt; 6 [label = &quot;eh1:&lt;eps&gt;&quot;, fontsize = 14];
6 [label = &quot;6&quot;, shape = circle, style = solid, fontsize = 14]
    6 -&gt; 1 [label = &quot;r:&lt;eps&gt;/0.69315&quot;, fontsize = 14];
    6 -&gt; 2 [label = &quot;r:&lt;eps&gt;/0.69315&quot;, fontsize = 14];
}

however, when i use the following command to convert the above code to svg, i got a wrong image as showing below.

cat a.dot | dot -Tsvg &gt; a.svg

‘rankdir=LR’ 在dot语言中不起作用。

What I expect is like this

‘rankdir=LR’ 在dot语言中不起作用。

As you can see I have used LR as rankdir.

rankdir = “LR”;

My question is how to get the second image?

I have search via Google, and failed to get any useful information. What I have tested includes:

  1. reinstall graphviz to 7.1.0 via conda (instead, but still cannot get the expected image)
  2. reinstall graphviz to 7.1.0 via yum (failed to install)
  3. tried other rankdir (not work)
  4. tried to convert to svg, png, ps formats via dot. (not work)

答案1

得分: 0

orientation = Landscape 是问题的根源。它与 rotate=90 同义(http://www.graphviz.org/docs/attrs/landscape/)。如果您删除该行,您将得到这个图形:
‘rankdir=LR’ 在dot语言中不起作用。

英文:

orientation = Landscape is the source of the problem.
It is synonymous with rotate=90 (http://www.graphviz.org/docs/attrs/landscape/).
If you remove that line, you get this graph:
‘rankdir=LR’ 在dot语言中不起作用。

huangapple
  • 本文由 发表于 2023年2月23日 21:20:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/75545405.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定