Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Optimize label position in Graphviz

Tags:

graphviz

dot

The following dotfile is creating a massive output :

digraph G {
    "Bob"->"A" [label=" A very long label"]
    "Bob"->"B" [label=" A very long label"]
    "Bob"->"C" [label=" A very long label"]
    "Bob"->"D" [label=" A very long label"]
    "Bob"->"E" [label=" A very long label"]
    "Bob"->"F" [label=" A very long label"]
    "Bob"->"G" [label=" A very long label"]
}

Outputs something like this : Huge graph

Is there a way to change the label positions to reduce the graph size ?

like image 656
Pol0nium Avatar asked Aug 03 '16 15:08

Pol0nium


2 Answers

Labels can be positioned with lp. You could change the labelangle. There are also headlabel and taillabel labels.
Search for 'label' in the documentation.

like image 88
dlamblin Avatar answered Nov 18 '22 14:11

dlamblin


Very simple \n solution

digraph G {
    "Bob"->"A" [label=" A very\nlong\nlabel"]
    "Bob"->"B" [label=" A very\nlong\nlabel"]
    "Bob"->"C" [label=" A very\nlong\nlabel"]
    "Bob"->"D" [label=" A very\nlong\nlabel"]
    "Bob"->"E" [label=" A very\nlong\nlabel"]
    "Bob"->"F" [label=" A very\nlong\nlabel"]
    "Bob"->"G" [label=" A very\nlong\nlabel"]
}
like image 20
RaHo Avatar answered Nov 18 '22 16:11

RaHo