如何更改 GraphViz 中边缘标签的背景颜色

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

我想在 Graphviz 中更改边缘标签的背景颜色。目前我能看到的唯一方法是使用 HTML table.

例如,

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"];

我想做的是shorter/cleaner:

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

他们在 graphviz 中有这个选项吗?

我尝试这样做的原因是因为结束标签最终写在边缘上,这使得标签难以阅读,背景颜色与 canvas 相同的颜色,人为地造成中断边缘。

谢谢

在 GraphViz 中,无法更改边缘标签的背景颜色。但是,您可以使用 HTML Table:

来实现相同的目的

例如:

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"];