我有一个图表,其中有3个子图放在一起,我希望它们一个堆叠在一起(我不希望子图内容的方向改变)。 / p>
简单的例子:
digraph G {
rankdir=TB;
subgraph cluster_lkg{
subgraph cluster_sentence_1{
"A1","A2","A3"
"A1" -> "A2"
"A1" -> "A3"
}
subgraph cluster_concepts_1{
"B1","B2","B3"
"B1" -> "B2"
"B1" -> "B3"
}
}
subgraph cluster_fkgs{
"C1","C2","C3"
"C1" -> "C2"
"C1" -> "C3"
}
}

答案 0 :(得分:0)
您需要连接群集(或者更确切地说,群集中的节点)才能使rankdir = TB
生效。您可以使用隐形边缘来完成此操作:
digraph G
{
rankdir=TB;
subgraph cluster_lkg
{
subgraph cluster_sentence_1
{
"A1","A2","A3"
"A1" -> "A2"
"A1" -> "A3"
}
subgraph cluster_concepts_1{
"B1","B2","B3"
"B1" -> "B2"
"B1" -> "B3"
}
//A1 -> B1;
}
subgraph cluster_fkgs
{
"C1","C2","C3"
"C1" -> "C2"
"C1" -> "C3"
}
edge[ style = invis ];
{ A2 A3 } -> B1;
{ B2 B3 } -> C1;
}
产生
节点C1
未对齐 - 我想这来自嵌套群集,但我没有反对它的配方。希望它无论如何都有帮助。