Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change the background color of a edge label in GraphViz

Tags:

graphviz

I am wanting to change the background color of an edge label in Graphviz. At the moment the only way I can see of doing this is using an HTML table.

Eg,

edge [len=3,fontcolor=red];
DeviceA -- DeviceB [headlabel=<
    <table border="0" cellborder="0">
        <tr>
            <td bgcolor="white">Head Label</td>
        </tr>
    </table>>
,taillabel="Tail Label"];

What I would like to be able to do is something shorter/cleaner:

edge [len=3,fontcolor=red,bgcolour=white];
DeviceA -- DeviceB [headlabel="Head Label",taillabel="Tail Label"];

Is their an option for this in graphviz?

The reason I am trying to do this is because end labels end up written over edges, which makes the label difficult to read, a background color the same color as the canvas, artificially creates a break in the edge.

Thanks

like image 272
Rowan Smith Avatar asked Feb 01 '18 06:02

Rowan Smith


1 Answers

In GraphViz there is no way to change the Background Colour of an Edge Label. However you can achieve the same by using a HTML Table:

Eg:

edge [len=3,fontcolor=red];
DeviceA -- DeviceB [headlabel=<
    <table border="0" cellborder="0">
        <tr>
            <td bgcolor="white">Head Label</td>
        </tr>
    </table>>
,taillabel="Tail Label"];
like image 57
Rowan Smith Avatar answered Dec 06 '22 10:12

Rowan Smith