Take the 2-minute tour ×

By default in Graphviz, edge labels are placed just to the right of the edge. I'm looking for a way to place the labels OVER the edge, centred on the edge. (It'll still be readable because I'm changing the colour of the edge).

Any ideas?

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

If this was headlabel or taillabel, You could try setting labeldistance to zero to force the label to be drawn on the edge, but as far as I understood, You are referring to edge label (the one on the middle of the edge). Documentation quite clearly states that labeldistance only has effect on headlabel and taillabel labels, but You can try Your luck.

One other thing You might want to try is to make a transparent, intermediary node with a label on it. It could look like You want... But if You heavily rely on node placement algorithm, it could be unacceptable to create those 'artificial' nodes. In that case, I can try to encourage You to join graphviz developers and add the feature You need ;) Seriously, it gives a lot of satisfaction.

If You will find another solution, please post it. I will be facing a similar problem in following months.

share|improve this answer
Yeah, looks like that's the whole of it at the moment. I will consider contributing to graphviz, but like you, my problem isn't going to be a problem for at leat another few months. –  naught101 Nov 28 '10 at 23:11
add comment

Your Answer


