我有很多盒子放在这样的水平上:
通过多条{rank=same a3 b3_1 b3_2 c3_1 c3_2 d3_1 d3_2};
行,而我用a3 [label = "Assigned"];
行定义元素。
我想在同一级别上的所有元素周围放置一个(点状,如果可能的话)框,例如(通过编辑器进行模型化):
整个来源如下:
digraph customer {
layout=dot
label = "some diagram";
labelloc = "t"; // place the label at the top
node [shape=record];
{rank=same a1 b1 c1 d1};
{rank=same a2 b2 c2 d2};
{rank=same a3 b3_1 b3_2 c3_1 c3_2 d3_1 d3_2};
{rank=same a4 b4_1_1 b4_1_2 b4_2_1 b4_2_2 c4_1_1 c4_1_2 c4_2_1 c4_2_2 d4_1_1 d4_1_2 d4_2_1 d4_2_2};
{rank=same a5 b5_1 b5_2 b5_3 b5_4 c5_1 c5_2 c5_3 c5_4 d5_1 d5_2 d5_3 d5_4};
{rank=same a6 b6_1 b6_2 b6_3 b6_4 c6_1 c6_2 c6_3 c6_4 d6_1 d6_2 d6_3 d6_4};
a1 [label = "Level 1"];
a2 [label = "Level 2"];
a3 [label = "Level 3"];
a4 [label = "Level 4"];
a5 [label = "Level 5"];
a6 [label = "Level 6"];
a1 -> a2 -> a3 -> a4; a4 -> a5 [label = "case ..." ]; a5 -> a6;
b1 [label = "Text A"];
b2 [label = "false"];
b3_1 [label = "no"];
b3_2 [label = "yes"];
b4_1_1 [label = "same"];
b4_1_2 [label = "different"];
b4_2_1 [label = "same"];
b4_2_2 [label = "different"];
b5_1 [label = "no", fillcolor = red, style=filled];
b5_2 [label = "no", fillcolor = red, style=filled];
b5_3 [label = "no", fillcolor = red, style=filled];
b5_4 [label = "yes", fillcolor = green, style=filled];
b6_1 [label = "yes", fillcolor = green, style=filled];
b6_2 [label = "yes", fillcolor = green, style=filled];
b6_3 [label = "yes", fillcolor = green, style=filled];
b6_4 [label = "yes", fillcolor = green, style=filled];
b1 -> b2;
b2 -> b3_1; b3_1 -> b4_1_1; b4_1_1 -> b5_1 [label = "A" ]; b5_1 -> b6_1;
b3_1 -> b4_1_2; b4_1_2 -> b5_2 [label = "B" ]; b5_2 -> b6_2;
b2 -> b3_2; b3_2 -> b4_2_1; b4_2_1 -> b5_3 [label = "C" ]; b5_3 -> b6_3;
b3_2 -> b4_2_2; b4_2_2 -> b5_4 [label = "D" ]; b5_4 -> b6_4;
subgraph clusterone {
a1; b1; c1; d1;
label="level 1";
graph[style=dotted];
}
c1 [label = "Text B"];
c2 [label = "true"];
c3_1 [label = "no"];
c3_2 [label = "yes"];
c4_1_1 [label = "same"];
c4_1_2 [label = "different"];
c4_2_1 [label = "same"];
c4_2_2 [label = "different"];
c5_1 [label = "no", fillcolor = red, style=filled];
c5_2 [label = "no", fillcolor = red, style=filled];
c5_3 [label = "yes", fillcolor = green, style=filled];
c5_4 [label = "yes", fillcolor = green, style=filled];
c6_1 [label = "yes", fillcolor = green, style=filled];
c6_2 [label = "yes", fillcolor = green, style=filled];
c6_3 [label = "yes", fillcolor = green, style=filled];
c6_4 [label = "yes", fillcolor = green, style=filled];
c1 -> c2;
c2 -> c3_1; c3_1 -> c4_1_1; c4_1_1 -> c5_1 [label = "E" ]; c5_1 -> c6_1;
c3_1 -> c4_1_2; c4_1_2 -> c5_2 [label = "F" ]; c5_2 -> c6_2;
c2 -> c3_2; c3_2 -> c4_2_1; c4_2_1 -> c5_3 [label = "G" ]; c5_3 -> c6_3;
c3_2 -> c4_2_2; c4_2_2 -> c5_4 [label = "H" ]; c5_4 -> c6_4;
d1 [label = "(else)"];
d2 [label = "???", fillcolor = yellow, style=filled];
d3_1 [label = "no"];
d3_2 [label = "yes"];
d4_1_1 [label = "same"];
d4_1_2 [label = "different"];
d4_2_1 [label = "same"];
d4_2_2 [label = "different"];
d5_1 [label = "no", fillcolor = red, style=filled];
d5_2 [label = "no", fillcolor = red, style=filled];
d5_3 [label = "no", fillcolor = red, style=filled];
d5_4 [label = "no", fillcolor = red, style=filled];
d6_1 [label = "yes", fillcolor = green, style=filled];
d6_2 [label = "yes", fillcolor = green, style=filled];
d6_3 [label = "yes", fillcolor = green, style=filled];
d6_4 [label = "yes", fillcolor = green, style=filled];
d1 -> d2;
d2 -> d3_1; d3_1 -> d4_1_1; d4_1_1 -> d5_1 [label = "I" ]; d5_1 -> d6_1;
d3_1 -> d4_1_2; d4_1_2 -> d5_2 [label = "J" ]; d5_2 -> d6_2;
d2 -> d3_2; d3_2 -> d4_2_1; d4_2_1 -> d5_3 [label = "K" ]; d5_3 -> d6_3;
d3_2 -> d4_2_2; d4_2_2 -> d5_4 [label = "L" ]; d5_4 -> d6_4;
}
答案 0 :(得分:2)
由于某种原因,它与rank=same
声明冲突。
尝试删除它,并在其中使用rank=same
来代替群集,如下所示:
subgraph cluster_one {
label="cluster one";
rank=same;
style=dotted;
a1 b1 c1 d1
};
subgraph cluster_two {
label="cluster two";
rank=same;
style=dotted;
a2 b2 c2 d2
};
或更短(一行):
subgraph cluster_one { label="cluster one" rank=same style=dotted a1 b1 c1 d1 }
请记住,子图的宽度将与以前不同。