Graphviz: Putting a Caption on a Node In Addition to a Label

前端 未结 1 851
天命终不由人
天命终不由人 2021-02-01 01:04

In my Graphviz graph (written in DOT), I want each node to have a label, but in addition to that, I want some nodes to have a small caption denoting some other unique value for

相关标签:
1条回答
  • 2021-02-01 01:15

    To place captions outside the node, you may use xlabel:

    digraph g {
        forcelabels=true;
        a [label="Birth of George Washington", xlabel="See also: American Revolution"];
        b [label="Main label", xlabel="Additional caption"];
        a-> b;
    }
    

    forcelabels=true makes sure no xlabel is omitted.

    xlabel for nodes example


    A second option is to use HTML-like labels:

    digraph g {
        a[label=<Birth of George Washington<BR />
            <FONT POINT-SIZE="10">See also: American Revolution</FONT>>];
    }
    

    html like labels example

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