Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphviz: Place edge label on the other side

Tags:

This may be related to How to place edge labels ON edge in graphviz: I have the following graph, which I visualize using the command dot -Teps g.dot > g.eps:

graph triple {     node [shape=box]; User; Object; Tag;     node [shape=diamond,style=filled]; Triple;     {         User -- Triple [label = "1"];         Object -- Triple [label = "1"];     }     {         rank=same;         User;         Object;     }     Triple -- Tag [label="n"]; } 

I would like the result to be more symmetric by putting the label between User and Triple on the left side of the graph.

like image 800
l0b0 Avatar asked Aug 10 '10 15:08

l0b0


1 Answers

Manual placement of edge labels cannot be done with graphviz.

However, you could use the headlabel, labeldistance and labelangle attributes:

graph triple { node [shape=box]; User; Object; Tag; node [shape=diamond,style=filled]; Triple;     {         User   -- Triple [headlabel = "1", labeldistance=2.5, labelangle=20];         Object -- Triple [headlabel = "1", labeldistance=2.5, labelangle=-20];     }     {         rank=same;         User;         Object;     }     Triple -- Tag [label="n"]; } 

Output:

graphviz output

like image 107
marapet Avatar answered Oct 19 '22 15:10

marapet