我一直在尝试在 Dot 中实现维恩图。虽然维恩图在 Dot 中可能没那么有用,但它主要是为了我可以将它用作非常基本的构建块。
我提供了一些我尝试过的方法:
graph G {
subgraph cluster0 {
color=white;
subgraph cluster0 {
label="1";
color=black;
a;
b;
}
subgraph cluster1 {
label="2";
color=black;
b;
c;
}
}
subgraph cluster1 {
color=white;
subgraph cluster2 {
label="1";
color=black;
d;
}
subgraph cluster3 {
label="1+2";
color=black;
e;
}
subgraph cluster4 {
label="2";
color=black;
f;
}
}
subgraph cluster2 {
color=white;
subgraph cluster5 {
label="1";
color=black;
g;
subgraph cluster6 {
label="2";
color=black;
h;
}
}
subgraph cluster6 {
label="2";
color=black;
i;
}
}
a -- d -- g [penwidth=0];
b -- e -- h [penwidth=0];
c -- f -- i [penwidth=0];
}
Run Code Online (Sandbox Code Playgroud)
生产:
这些都存在问题:
b是在1,但不是2。当它应该在两者中时。1and分开的2。并且很难证明两者都是。2子图连接在一起。为了防止 XY 问题,我有:
三个应用程序。位于:
导致:
graph G {
subgraph cluster0 {
color=white;
subgraph cluster0 {
label="Server1";
color=black;
a;
subgraph cluster0 {
label="Docker";
b;
}
}
subgraph cluster1 {
label="Server2";
color=black;
subgraph cluster0 {
label="Docker";
c;
}
}
}
subgraph cluster1 {
color=white;
subgraph cluster0 {
label="Server1";
color=black;
d;
}
subgraph cluster1 {
label="Docker";
color=black;
subgraph cluster0 {
label="Server1";
e;
}
subgraph cluster1 {
label="Server2";
f;
}
}
}
a -- d [penwidth=0];
b -- e [penwidth=0];
c -- f [penwidth=0];
}
Run Code Online (Sandbox Code Playgroud)