子图水平,其节点垂直对齐 [英] Subgraphs horizontal and its nodes vertical aligned
本文介绍了子图水平,其节点垂直对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在组织子图水平而在子图内部垂直时遇到问题.它们(子图和节点)全部都在一条线上(水平或垂直).
I have problems to organize my subgraphs horizontal and the nodes inside the subgraphs vertical. All of them (subgraphs and nodes) are just on one line (horizontal or vertical).
digraph G {
rankdir = LR;
subgraph cluster_0 {
rankdir = TB;
node [style=filled];
label = "Title 1";
color=black
N1 -> N2;
}
subgraph cluster_1 {
rankdir = TB;
node [style=filled];
label = "Title 2";
color=black
N3 -> N4 -> N5;
}
subgraph cluster_2 {
rankdir = TB;
node [style=filled];
...
}
...
N2 -> N3;
...
N1 [label = "BA_A", fillcolor="green", shape="Msquare"]
N2 [label = "W2", fillcolor="green", shape="octagon"]
N3 [label = "BA_A", fillcolor="green", shape="Msquare"]
N4 [label = "W2", fillcolor="green", shape="octagon"]
N5 [label = "W2_ERROR", fillcolor="red", shape="octagon"]
N6 [label = "W3", fillcolor="green", shape="invtriangle"]
...
}
我也尝试过使用{rank=same; N1; N3; ...;}
.这会将节点从子图中移出.
I also tried with {rank=same; N1; N3; ...;}
. This take the nodes out of the subgraphs.
推荐答案
您可以使用类似的方法:
You can use something like that:
digraph G {
rankdir = LR;
subgraph cluster_0 {
{rank=same N1 N2}
label = "Title 1";
N1 -> N2;
}
subgraph cluster_1 {
{rank=same N3 N4 N5}
label = "Title 2";
N3 -> N4 -> N5;
}
subgraph cluster_2 {
node [style=filled];
label = "Title 3";
N6;
}
N2 -> N3;
N5 -> N6;
N1 [label = "BA_A", fillcolor="green", shape="Msquare"]
N2 [label = "W2", fillcolor="green", shape="octagon"]
N3 [label = "BA_A", fillcolor="green", shape="Msquare"]
N4 [label = "W2", fillcolor="green", shape="octagon"]
N5 [label = "W2_ERROR", fillcolor="red", shape="octagon"]
N6 [label = "W3", fillcolor="green", shape="invtriangle"]
}
这篇关于子图水平,其节点垂直对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文