英文:
'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
以下是我期望的结果:
正如您所看到的,我已经使用LR作为rankdir。
rankdir = "LR";
我的问题是如何获得第二个图像?
我通过Google搜索,未能获得任何有用的信息。我已经尝试的包括:
- 通过conda重新安装到7.1.0版本的Graphviz(但仍无法获得期望的图像)。
- 通过yum重新安装Graphviz到7.1.0版本(未能安装成功)。
- 尝试其他rankdir(不起作用)。
- 尝试通过dot将其转换为SVG、PNG、PS格式(不起作用)。
希望您能提供一些建议,以便我获得预期的图像。
英文:
I have the following dot code
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];
}
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 > a.svg
What I expect is like this
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:
- reinstall graphviz to 7.1.0 via conda (instead, but still cannot get the expected image)
- reinstall graphviz to 7.1.0 via yum (failed to install)
- tried other rankdir (not work)
- 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/)。如果您删除该行,您将得到这个图形:
英文:
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:
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论