带点文字换行(graphviz) [英] Text wrapping with dot (graphviz)
问题描述
我使用下面的代码使用点(graphviz)创建图形.
I used the code below to create a graphic using dot (graphviz).
digraph
{
node [color=Blue,shape=box]
1.1 [label="Frequency of t exceeds upper threshold"]
2.1 [label="t has d-mutant tiles"]
2.2 [label="Valid"]
3.1 [label="Frequency of t exceeds lower threshold"]
3.2 [label="Frequency of t exceeds lower threshold"]
4.1 [label="Insufficient evidence"]
4.2 [label="Valid"]
4.3 [label="t has only one d-mutant that exceeds lower threshold"]
4.4 [label="Are there any d-mutant tiles with significantly higher frequencies?"]
5.1 [label="Insufficient evidence"]
node [color=Green] 5.2 [label="Correct t to t'"] node [color=Blue]
5.3 [label="t has a d-mutant tile t' that is closer than all other d-mutant tiles and for which a corrected base has a higher quality score"]
5.4 [label="Valid"]
6.1 [label="Insufficient evidence"]
6.2 [label="t' is unique"]
7.1 [label="Insufficient evidence"]
node [color=Green] 7.2 [label="Correct t to t'"] node [color=Blue]
1.1 -> 2.1 [label="no"]
1.1 -> 2.2 [label="yes"]
2.1 -> 3.1 [label="no"]
2.1 -> 3.2 [label="yes"]
3.1 -> 4.1 [label="no"]
3.1 -> 4.2 [label="yes"]
3.2 -> 4.3 [label="no"]
3.2 -> 4.4 [label="yes"]
4.3 -> 5.1 [label="no"]
4.3 -> 5.2 [label="yes"]
4.4 -> 5.3 [label="no"]
4.4 -> 5.4 [label="yes"]
5.3 -> 6.1 [label="no"]
5.3 -> 6.2 [label="yes"]
6.2 -> 7.1 [label="no"]
6.2 -> 7.2 [label="yes"]
}
如您所见,图形中的某些框在标签中包含很多文本.我可以插入\n
字符以确保盒子不太宽,但是我想知道是否有一种方法可以设置盒子的宽度,然后让盒子标签进行硬包装.这可能吗?
As you can see, some of the boxes in the graphic have a lot of text in the label. I can insert \n
characters to make sure the boxes aren't too wide, but I'm wondering if there is a way I can set the width of the boxes and then have the box labels do a hard wrap. Is this possible?
推荐答案
graphviz不支持自动换行符.您必须手动输入\ n.
graphviz doesn't support automatic line breaks. You have to put the \n in manually.
您可以为节点设置宽度和高度并将其定义为fixedsize-这将 限制节点的大小,并且仅绘制适合该节点的文本
you can set a width and a height to a node and define it as fixedsized - this will limit the size of the node and draw only as much text as fits into the node
这篇关于带点文字换行(graphviz)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!