Search code examples
graphvizdot

'rankdir=LR' does not work in dot language


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

enter image description here

What I expect is like this

enter image description here

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)

Solution

  • 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:
    enter image description here