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

时间:2010-12-22 22:40:58

标签: graphviz dot

考虑这个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];”?

编辑:仅供参考 - answer from Jesse不包含任何代码;我写了那个片段并在这里占据了这个空间 - 由于不明原因,主持人将其从这里剪掉并粘贴到Jesse的答案中。

2 个答案:

答案 0 :(得分:35)

使用 edge 属性语句,如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
    }
}

答案 1 :(得分:6)

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

相关问题