Search code examples
svggraphvizdot

Graphviz dot produces only part of image


I have some dot code saved as foo.dot:

digraph finite_state_machine {
    rankdir=LR;
    size="8,5"
    node [shape = doublecircle]; LR_0 LR_3 LR_4 LR_8;
    node [shape = circle];
    LR_0 -> LR_2 [ label = "SS(B)" ];
    LR_0 -> LR_1 [ label = "SS(S)" ];
    LR_1 -> LR_3 [ label = "S($end)" ];
    LR_2 -> LR_6 [ label = "SS(b)" ];
    LR_2 -> LR_5 [ label = "SS(a)" ];
    LR_2 -> LR_4 [ label = "S(A)" ];
    LR_5 -> LR_7 [ label = "S(b)" ];
    LR_5 -> LR_5 [ label = "S(a)" ];
    LR_6 -> LR_6 [ label = "S(b)" ];
    LR_6 -> LR_5 [ label = "S(a)" ];
    LR_7 -> LR_8 [ label = "S(b)" ];
    LR_7 -> LR_5 [ label = "S(a)" ];
    LR_8 -> LR_6 [ label = "S(b)" ];
    LR_8 -> LR_5 [ label = "S(a)" ];
}

When I run the following commands I get the output I expect for PDF and PNG, but SVG shows only part of the diagram:

  • $ dot -T svg foo.dot -O
  • $ dot -T pdf foo.dot -O
  • $ dot -T png foo.dot -O

What might be causing this, and how do I fix it?

$ dot -V returns 'dot - graphviz version 2.43.0 (0)'; I am using Ubuntu 20.10.

(I have attached a PNG version of the produced SVG; I can't attach SVG.)

part of a finite state diagram


Solution

  • As people are not always browsing through the comments.

    Tests with:

    • dot - graphviz version 2.38.0 (20140413.2041) and dot - graphviz version 2.44.1 (20200629.0800) on Windows
    • dot - graphviz version 2.40.1 (20161225.0304) on Cygwin
    • running on webgraphviz.com

    look all OK.

    The problem looks like to be present in the 2.43 version see also https://gitlab.com/graphviz/graphviz/-/issues/1605 as indicated by @twsh).