具有长节点标签的图形的最佳布局

时间:2012-12-09 04:42:52

标签: layout visualization graphviz

我的图表有很长的节点标签。 Neato让事情重叠; Circo做我想要的,它只是在节点之间创造了太多的空间。我想使用Circo结果并将节点拉近距离。

图表代码:https://clbin.com/BbsNP

digraph {
graph [overlap=scale];
graph [bgcolor=white];
node [shape=box];
0 [label="long node label"
  ,shape=box];
1 [label="long node label"
  ,shape=box];
2 [label="aoeu aoe uaoeu oae ueaoo"
  ,shape=box];
3 [label="long node labelau"
  ,shape=box];
4 [label="aoeu aoe uaoeu oae ueaooeu"
  ,shape=box];
5 [label="long node labelaoeu"
  ,shape=box];
6 [label="aoeu aoe uaoeu oae ueaoe"
  ,shape=box];
7 [label="long node labelaoeuo"
  ,shape=box];
8 [label="aoeu aoe uaoeu oae ueao"
  ,shape=box];
9 [label="234 aoeua",shape=box];
10 [label="long node labeluu"
   ,shape=box];
11 [label="aoeu aoe uaoeu oae ueao"
   ,shape=box];
12 [label=oeuaoeu,shape=box];
13 [label="long node labelaa"
   ,shape=box];
14 [label="aoeu aoe uaoeu oae ueao"
   ,shape=box];
15 [label=aoeu,shape=box];
16 [label=aoeu,shape=box];
0 -> 1 [color=blue];
1 -> 0 [color=blue];
2 -> 1 [color=blue];
3 -> 0 [color=blue];
4 -> 3 [color=blue];
5 -> 0 [color=blue];
6 -> 5 [color=blue];
7 -> 0 [color=blue];
8 -> 7 [color=blue];
9 -> 7 [color=blue];
10 -> 0 [color=blue];
11 -> 10 [color=blue];
12 -> 10 [color=blue];
13 -> 0 [color=blue];
14 -> 13 [color=blue];
15 -> 13 [color=blue];
16 -> 13 [color=blue];
}

图片:http://postimage.org/image/mrcak2021/

circo -T jpg Test.Layout.LongNodeLabel.dot > Test.Layou.LongNodeLabel.jpg

1 个答案:

答案 0 :(得分:1)

问题类似于this recent question中的问题。如果您愿意使用twopi而不是circo,则可以将ranksep设置为拉入或推出节点 - 以更改“同心圆的径向分离”,文档描述了它。

我改变你的图形代码就像这样开始:

digraph {
    graph [bgcolor=white, overlap=true, ranksep=2.75];

然后使用twopitwopi test_graph.txt -Tpng -otest_graph.png对其进行绘制。这将生成以下图表:

graph using twopi

以下是原始比较:

graph using circo http://s12.postimage.org/fo4f4fumk/Test_Layou_Long_Node_Label.jpg