Graphviz dot: How to change the colour of one record in multi-record shape

前端 未结 1 759
清酒与你
清酒与你 2020-12-24 08:38

I have the following dot sample. I would like to give the first section in each record (the table name) a different background and foreground colour. I can\'t find any examp

1条回答
  •  别那么骄傲
    2020-12-24 09:09

    I'm pretty sure that it's not possible. Instead you should use HTML-style labels, that are a more developped form of record nodes. You can define your node using the

    tag, and set the color using bgcolor="your_color". A list of available colors is available here: http://www.graphviz.org/doc/info/colors.html (you also have a RGBA way of doing it, as described here: http://www.graphviz.org/doc/info/attrs.html#k:color)

    With HTML labels, your example becomes as follows:

    digraph G
    {
        rankdir = LR;
        node1
        [
            shape = none
            label = <
    corpus_language
    id: en
    name: Englist
    sentence_count: 1027686
    > ] node2 [ shape = none label = <
    corpus_sentence
    id: 1241798
    text: Baseball is a sport
    creator_id: 10859
    created_on: 2006-11-14 17:58:09.303128
    language_id: en
    activity_id: 11
    score: 124
    > ] node1:port2 -> node2:port6 [label="language_id"] }

    Here is the result:

    enter image description here

    0 讨论(0)
提交回复
热议问题