Graphviz: shortcut on the left

if I use the following Graphviz code, a simple graph will be created that shows the label on the right side.

digraph lable_on_the_right_side { /* define nodes */ node [color=lightblue2, style=filled, fontname=Arial]; a [label="S1"]; b [label="S2"]; /* define edges */ a -> b [label="Label on the right side"] } 

Rendered Dot Code as Image

Is it possible for the label to appear on the left side? If so, what code should look like?

+6
source share
1 answer

There are not many ways to change the position of the label text of the label - you can try to add extra extra spaces for the label ... Sometimes also double edges have the right to have one label on the right and the other on the left.

Still hacked, but at least headlabel , you can use headlabel (or taillabel ) and then use labelangle along with labeldistance to position the label where you want:

 a -> b [ headlabel="Label on the left side" labeldistance=7.5 labelangle=75 ] 

enter image description here

With a bit of trial and error, you can put a shortcut where you need it.

+7
source

Source: https://habr.com/ru/post/944208/


All Articles