Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distinct colors for headlabel and taillabel in graphviz

Tags:

graphviz

dot

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).

like image 568
bedrorom Avatar asked Jul 12 '13 12:07

bedrorom


1 Answers

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:

enter image description here

like image 182
Bastien Pasdeloup Avatar answered Sep 19 '22 17:09

Bastien Pasdeloup