【问题标题】:How to change arrowhead type?如何更改箭头类型?
【发布时间】:2016-07-08 07:45:43
【问题描述】:

我想用 .dot 模拟非方向图。为此,我希望箭头类型为“无”。如何设置?

"f" -> "t" [label=2],[arrowhead=none]
"m" -> "d" [label=0],[arrowhead=none]

上述方法无效。

【问题讨论】:

标签: syntax graphviz


【解决方案1】:
"f" -> "t" [label=2, arrowhead=none]

例如:

digraph g {
  rankdir="LR";
  dpi=300;
  node[
    fontname="Arial",
    shape="square",
    fixedsize=false,
    width=1.809,
    style=rounded
  ];

  edge [
    arrowhead="none"
  ];

  Node1 -> Node2;
  Node2 -> Node3;
  Node3 -> Node4;
}

【讨论】:

    【解决方案2】:

    另一个不错的方法是使用 'dir' 属性:

       "f" -> "t" [label=2 dir=none]
       "m" -> "d" [label=0 dir=none]
    

    另见http://martin-loetzsch.de/DOTML/dir.html

    【讨论】:

    • 这很好,因为“dir”属性比“arrowhead”短。
    【解决方案3】:

    如果您不必创建digraph,则可以使用graph

    1. 将点文件顶部的digraph { 替换为graph {
    2. 将节点关系更改为:a -- b;

    【讨论】:

      【解决方案4】:

      您可以本地全局更改箭头。

      digraph G
      {
          edge[arrowhead="odiamond"]; // Globally
      
          A -> B
          A -> C [arrowhead="vee"]; // Locally
          C -> D
          C -> E
      }
      

      你可以在GraphvizFiddle上测试它

      所有可能的值都可以找到Here

      【讨论】:

      • 谢谢!我试图搜索如何全局设置箭头样式,这有帮助!
      【解决方案5】:
      "f" -> "t" [label=2 arrowhead=none]
      "m" -> "d" [label=0 arrowhead=none]
      

      【讨论】:

        【解决方案6】:

        使用headport 而不是arrowhead。阅读dot guide

        【讨论】:

        • Headport 控制箭头连接到节点的位置,而不是箭头形状。
        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-05-29
        • 2012-06-01
        • 1970-01-01
        • 2011-03-01
        • 2014-04-04
        相关资源
        最近更新 更多