简体   繁体   English

如何防止graphviz在标签上绘制边缘?

[英]How can I prevent graphviz from drawing edges over labels?

If I run graphviz on this digraph:如果我在这个有向图中运行 graphviz:

digraph G {
    subgraph cluster_0 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        a0; a1;  a2;  a3;
        label = "sources";
    }

    subgraph cluster_1 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        b0; b1; b2; b3;
        label = "intermediaries";
    }
        a0 -> b0; a1 -> b0;
        a0 -> b1; a1 -> b1;
        a2 -> b2; b0 -> b2;
        b1 -> b2; a3 -> b3;
        b0 -> b3; b1 -> b3;
}

I get我得到

在此处输入图片说明

with many edges intersecting the "intermediaries" label.许多边与“中介”标签相交。 How do I get graphviz to make edges avoid labels?如何让 graphviz 使边缘避免标签?

As a workaround:作为解决方法:

digraph G {
    subgraph cluster_0 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        a0; a1;  a2;  a3;
        label = "sources";
    }

    subgraph cluster_1 {
        style=filled;
        color=lightgrey;
        node [style=filled,color=white];
        nodelabel [label="intermediaries"; style=filled; color=lightgrey]
        nodelabel -> b1 [style=invis];
        nodelabel -> b0 [style=invis];
        b0; b1; b2; b3;
    }
        a0 -> b0; a1 -> b0;
        a0 -> b1; a1 -> b1;
        a2 -> b2; b0 -> b2;
        b1 -> b2; a3 -> b3;
        b0 -> b3; b1 -> b3;
}

produce:产生:

输出

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM