本文介绍了graphviz中headlabel和taillabel的不同颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在graphviz中为headlabel和taillabel设置不同的颜色?使用labelfontcolor我可以为它们设置一种共同的颜色,但是我需要不同的颜色(例如headfontcolor和tailfontcolor,但是这些属性不存在).

Is it possible to set distinct colors for headlabel and taillabel in graphviz?Using labelfontcolor I can set one common color for both of them but I need different colors (something like headfontcolor and tailfontcolor but these attributes don't exist).

推荐答案

您可以使用graphviz中的HTML样式标签成功完成此操作(您可以在此页面上找到很多信息: http://www.graphviz.org/doc/info/shapes.html ),尤其是font一个:

You can succeed doing this using the HTML-style labels in graphviz (you can find lots of information on this page: http://www.graphviz.org/doc/info/shapes.html), and particularly the font one:

digraph test
{
    A -> B
    [
        taillabel = <<font color="red">tail</font>>
        label     = <<font color="green">middle</font>>
        headlabel = <<font color="blue">head</font>>
    ]
}

此代码将产生以下图表:

This code will produce the following diagram:

这篇关于graphviz中headlabel和taillabel的不同颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-19 02:52