Graphviz 点:当一个节点位于子图中时,如何连接到节点
我有以下图表:Graphviz 点:当一个节点位于子图中时,如何连接到节点,graphviz,Graphviz,我有以下图表: digraph D { node [ fontname = "Arial" fontsize = 11 shape = "record" ] A [ label = "my_A" ] B [ label = "my_B" ] subgraph cluster_mg { label = "Main Group"; penwidth = 1 color = "black"
digraph D {
node [
fontname = "Arial"
fontsize = 11
shape = "record"
]
A [ label = "my_A" ]
B [ label = "my_B" ]
subgraph cluster_mg {
label = "Main Group";
penwidth = 1
color = "black"
subgraph cluster_subgroup1 {
color = "black";
style = dashed;
label = "Subgroup 1"
A
}
subgraph cluster_subgroup2 {
color = "white"
penwidth = 0;
label = "Subgroup 2"
B
}
}
#A -> B
#{ rank=same A B }
}
注释掉最后两行后,生成以下图形:
我想在我的_A和我的_B之间添加一个箭头。当我这样做时(通过取消注释第一个注释掉的行),我的_A和我的_B是垂直放置的,而不是水平放置的。当我将它们的等级设置为相同时,我丢失了虚线轮廓。我如何构造与此处显示的相同的图形,但从我的a到B有一条线
另外,如何将我的A放在左边,B放在右边?添加
rankdir = LR;
对于图形[]
部分,我做了我需要的:
digraph D {
graph [ rankdir = LR ]
node [
fontname = "Arial"
fontsize = 11
shape = "record"
]
A [ label = "my_A" ]
B [ label = "my_B" ]
subgraph cluster_mg {
label = "Main Group";
penwidth = 1
color = "black"
subgraph cluster_subgroup1 {
color = "black";
style = dashed;
label = "Subgroup 1"
A
}
subgraph cluster_subgroup2 {
color = "white"
penwidth = 0;
label = "Subgroup 2"
B
}
}
A -> B
}
添加
rankdir = LR;
对于图形[]
部分,我做了我需要的:
digraph D {
graph [ rankdir = LR ]
node [
fontname = "Arial"
fontsize = 11
shape = "record"
]
A [ label = "my_A" ]
B [ label = "my_B" ]
subgraph cluster_mg {
label = "Main Group";
penwidth = 1
color = "black"
subgraph cluster_subgroup1 {
color = "black";
style = dashed;
label = "Subgroup 1"
A
}
subgraph cluster_subgroup2 {
color = "white"
penwidth = 0;
label = "Subgroup 2"
B
}
}
A -> B
}
这是否回答了您的问题?我感谢你的帮助。不幸的是,这个例子并没有解决我的问题。不过我现在已经弄明白了。这能回答你的问题吗?我感谢你的帮助。不幸的是,这个例子并没有解决我的问题。不过我现在已经弄明白了。你能说得更清楚一点吗?从你的回答来看,不清楚把
rankdir=LR代码>。请在答案中提供一个完整的示例和图片。请您更明确一点,因为您的答案不清楚将rankdir=LR代码>。请在答案中附上完整的示例和图片。