Graphviz:在标签上添加标题到节点上 [英] Graphviz: Putting a Caption on a Node In Addition to a Label
问题描述
在我的Graphviz图(用DOT编写)中,我希望每个节点都有一个标签,但是除此之外,我希望某些节点具有一个小的标题,表示该节点的其他唯一值.例如,如果这是用于历史记录图,则节点的标签可能类似于乔治华盛顿的出生",并且标题可能显示为另请参阅:美国革命".
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 that node. For example, if this were for a history diagram, a node's label might be something like "Birth of George Washington" and the caption might read "See also: American Revolution."
这是相当灵活的,因此标题不一定必须位于节点内,但我确实需要其他方式来放置显然不属于标签的文本(例如,大小不同,可能是颜色不同),并且位置不同,但显然仍然是节点的一部分.
This is fairly flexible, so the caption doesn't necessarily need to be inside the node, but I do need some other way of putting text that clearly isn't part of the label (e.g. is a different size, possibly a different color) and is in a different location but is still clearly a part of the node.
有什么办法吗?
推荐答案
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
确保没有省略xlabel.
forcelabels=true
makes sure no xlabel is omitted.
第二种选择是使用类似HTML的标签:
digraph g {
a[label=<Birth of George Washington<BR />
<FONT POINT-SIZE="10">See also: American Revolution</FONT>>];
}
这篇关于Graphviz:在标签上添加标题到节点上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!