简体   繁体   English

Graphviz 问题 - 垂直然后水平 alignment

[英]Graphviz question - vertical then horizontal alignment

Looking for help on below with Graphviz I've managed to alight subgraphs vertically (cluster0->cluster1->cluster2->etc) by using rankdir=TB and then invisible connection.在下面使用 Graphviz 寻求帮助我已经设法通过使用 rankdir=TB 然后使用不可见连接垂直放置子图(cluster0->cluster1->cluster2->etc)。

But how to order numbers within a cluster from left to right?但是如何从左到右对一个簇内的数字进行排序呢? so it would look like first row: 1 2 3 4 5 6 second row: 11 22 33 44 55 66...etc...所以它看起来像第一行:1 2 3 4 5 6 第二行:11 22 33 44 55 66 ...等...

Thus top to bottom by cluster number, then left to right by node within a cluster.因此从上到下按簇编号,然后从左到右按簇内的节点。

Thanks in advance!提前致谢!

digraph G {
node [shape=box,style=filled];
newrank=True;
rankdir=TB;
splines=ortho;

1-> 11[style=invis];
11->111[style=invis];
111->1111[style=invis];
subgraph cluster_0 {
rank=same;
1
2
3
4
5
6
}
subgraph cluster_1 {
rank=same;
11
22
33
44
55
66
}
subgraph cluster_2 {
rank=same;
111
222
333
444
555
666
}
subgraph cluster_4 {
rank=same;
1111
2222
3333
4444
5555
6666
}
1->6666
}

Tried all sorts of things.尝试了各种各样的事情。

Using the node shape as record was the solution.使用节点形状作为记录是解决方案。

digraph G {
node [shape=record]
newrank=True;
rankdir=TB;
#splines=ortho;
ranksep=0.7;
#clusterrank=local;

D0:1-> D1:1[style=invis];
D1:1-> D2:1[style=invis];
D2:1-> D3:1[style=invis];
subgraph cluster_0 {
rank=same;
D0[label="<1>Port1|<2>Port2|<3>Port3|<4>Port4"]
}
subgraph cluster_1 {
rank=same;
D1[label="<1>Port1|<2>Port2|<3>Port3|<4>Port4"]
}
subgraph cluster_2 {
rank=same;
D2[label="<1>Port1|<2>Port2|<3>Port3|<4>Port4"]
}
subgraph cluster_4 {
rank=same;
D3[label="<1>Port1|<2>Port2|<3>Port3|<4>Port4"]
}
D0:1->D3:4
}

Result:结果:

图形结果到

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM