Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphviz: Color only a field in a Record-based Node

Tags:

graphviz

Is there a way to add color to only a field in a record-based node. Like in the following example, can the field struct2:f0 alone be in different color?

digraph structs {
node [shape=record];
struct1 [label="<f0> left|<f1> mid\ dle|<f2> right"];
struct2 [label="<f0> one|<f1> two"];
struct3 [label="hello\nworld |{ b |{c|<here> d|e}| f}| g | h"];
struct1:f1 -> struct2:f0;
struct1:f2 -> struct3:here;
}

Thx

like image 512
iobelix Avatar asked Jan 25 '12 20:01

iobelix


2 Answers

I don't think this is possible.

You may consider using HTML-like labels - you should be able to do everything you can do with record-based nodes, and more.

From the above linked documentation page:

The record-based shape has largely been superseded and greatly generalized by HTML-like labels. That is, instead of using shape=record, one might consider using shape=none and an HTML-like label.

and

Although HTML labels are not, strictly speaking, a shape, they can be viewed as a generalization of the record shapes described above. In particular, if a node has set its shape attribute to none or plaintext, the HTML label will be the node's shape.

like image 96
marapet Avatar answered Oct 24 '22 18:10

marapet


Try this:

  digraph G {
    "Record" [ label=<<table>
                          <tr>
                              <td>A</td>
                              <td bgcolor='#00CC11'>B</td>
                          </tr>
                       </table> 
                      >
             ];
  }
like image 21
dgw Avatar answered Oct 24 '22 18:10

dgw