Graphviz:如何设置“默认”箭头样式?

发布于 2024-10-08 13:59:47 字数 663 浏览 0 评论 0原文

考虑这个 dot 语言代码:

digraph graphname {
    subgraph clusterA {
        node [shape=plaintext,style=filled];
        1 -> 2 [arrowhead=normal,arrowtail=dot];
        2 -> 3 -> X2 -> 5;
        6;
        7;
        label = "A";
        color=blue
    }
}

在上面的示例中,只有 1 -> 。 2 连接将应用 arrowhead=normal,arrowtail=dot 样式;所有其他箭头都将采用“默认”样式。

我的问题是 - 如何设置箭头样式(对于整个子图 - 或整个图),而不必在旁边复制粘贴“[arrowhead=normal,arrowtail=dot];”每个边连接?

编辑:仅供参考 - 杰西的回答不包含任何代码;我写了这个片段并将其放在此处 - 由于未知原因,主持人将其从此处剪掉并将其粘贴到杰西的答案中。

Consider this dot language code:

digraph graphname {
    subgraph clusterA {
        node [shape=plaintext,style=filled];
        1 -> 2 [arrowhead=normal,arrowtail=dot];
        2 -> 3 -> X2 -> 5;
        6;
        7;
        label = "A";
        color=blue
    }
}

In the above example, only the 1 -> 2 connection will have the arrowhead=normal,arrowtail=dot style applied; all the other arrows will be of the "default" style.

My question is - how do I set the arrow style (for the entire subgraph - or for the entire graph), without having to copy paste "[arrowhead=normal,arrowtail=dot];" next to each edge connection?

EDIT: Just for reference - the answer from Jesse didn't contain any code; I wrote that snippet and had it in this space here - for unknown reasons, a moderator cut it off from here and pasted it into Jesse's answer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

雨落星ぅ辰 2024-10-15 13:59:47

使用 edge 属性语句,如 DOT 语言中所述文档

digraph graphname {
    subgraph clusterA {
        node [shape=plaintext,style=filled];
        edge [arrowhead=normal,arrowtail=dot];
        1 -> 2 ;
        2 -> 3 -> X2 -> 5;
        6;
        7;
        label = "A";
        color=blue
    }
}

Use the edge attribute statement, as stated in the DOT Language documentation.

digraph graphname {
    subgraph clusterA {
        node [shape=plaintext,style=filled];
        edge [arrowhead=normal,arrowtail=dot];
        1 -> 2 ;
        2 -> 3 -> X2 -> 5;
        6;
        7;
        label = "A";
        color=blue
    }
}
¢好甜 2024-10-15 13:59:47

就像您对节点所做的那样,但使​​用 edge,例如 edge[style=dashed]

Just like you did for nodes, but using edge, e.g. edge[style=dashed]

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文