点维恩图

Pei*_*ayz 7 dot venn-diagram

我一直在尝试在 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 问题,我有:

  • 两台服务器,
  • 两台服务器之间的 docker swarm,以及
  • 三个应用程序。位于:

    • 一个位于第一台服务器上,而不是在 docker swarm 中。
    • 其中一个位于 docker swarm 中的第一台服务器上。
    • 其中一个位于 docker swarm 中的第二台服务器上。

导致:

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)

显示 docker 服务器分组的两种不同方式