我有一个graphiz项目,我想从左到右水平放置集群,中间使用cluster_c2(称为QGIS)。我尝试按照[此处] [1]所述使用newrank=true;
,但未成功。我的graphviz脚本的当前输出是:
[![在此处输入图片描述] [2]] [2]
我当前的脚本是:
digraph {
node [shape=record, fontname="Arial"];
rankdir=LR;
L [label="Line"]
ML [label="Multi-Line"]
QL [label="Line"]
QML [label = "Multi-Line"]
QCS [label = "Circular-String"]
QCC [label = "Compound-Curve"]
P [label="PolyLine"]
subgraph cluster_c1 {
label = "SpatiaLite";
fontname="Arial";
L;
ML;
}
subgraph cluster_c2 {
label = "QGIS";
fontname="Arial";
QL;
QML;
QCS;
QCC;
}
subgraph cluster_c3 {
label = "Shapefile";
fontname="Arial";
P;
}
L -> QL [dir=both];
QCS -> L [color=grey];
QCS -> ML [color=grey];
QCC -> ML [color=grey];
QML -> ML [dir=both];
QCC -> L [ color=grey];
QML-> L [color=grey];
QL -> ML [color=grey];
QCS -> P;
QCC -> P;
QML -> P [dir=both];
QL -> P ;
}
[1]: https://stackoverflow.com/questions/6824431/placing-clusters-on-the-same-rank-in-graphviz
[2]: https://i.stack.imgur.com/m2O7Q.png
答案 0 :(得分:1)
我不知道它是如何工作的,但是似乎每个子图中newrank="true"
和rank=same
的组合都起作用:
digraph {
node [shape=record, fontname="Arial"];
newrank=true;
rankdir=LR;
L [label="Line"];
ML [label="Multi-Line"];
QL [label="Line"];
QML [label = "Multi-Line"];
QCS [label = "Circular-String"];
QCC [label = "Compound-Curve"];
P [label="PolyLine"];
subgraph cluster_c1 {
rank=same;
label = "SpatiaLite";
fontname="Arial";
L;
ML;
}
subgraph cluster_c2 {
rank=same;
label = "QGIS";
fontname="Arial";
QL;
QML;
QCS;
QCC;
}
subgraph cluster_c3 {
rank=same;
label = "Shapefile";
fontname="Arial";
P;
}
L -> QL [dir=both];
ML -> QML [dir=both];
QCS -> L [color=grey];
QCS -> ML [color=grey];
QCC -> ML [color=grey];
QCC -> L [ color=grey];
QML-> L [color=grey];
QL -> ML [color=grey];
QCS -> P;
QCC -> P;
QML -> P [dir=both];
QL -> P ;
}