【问题标题】:How do I force straight edges in a (simple) Digraph?如何在(简单)有向图中强制使用直边?
【发布时间】:2018-06-21 15:49:28
【问题描述】:

我有以下简单的有向图:

digraph clientproxyserver {
  "Client" -> "Proxy" [ label="Request from Client" ];
  "Proxy" -> "Server" [ label="Forwarded Request" ];
  "Server" -> "Proxy" [ label="Response from Server" ];
  "Proxy" -> "Client" [ label="Forwarded Response" ];
}

运行这个低谷dot

dot -Grankdir=LR -Nshape=box -Nheight=1 -Tpng -ocps.png cps.gv

我得到以下结果:

如何使两条底边成为直线?

【问题讨论】:

    标签: graphviz


    【解决方案1】:

    这就是splines=ortho 选项通常的用途:

    digraph clientproxyserver {
        rankdir=LR;
        node[shape=box, height=1];
        splines=ortho
      "Client" -> "Proxy" [ label="Request from Client" ];
      "Proxy" -> "Server" [ label="Forwarded Request" ];
      "Server" -> "Proxy" [ label="Response from Server" ];
      "Proxy" -> "Client" [ label="Forwarded Response" ];
    }
    

    不幸的是,边缘/标签的位置非常混乱:

    根据我的经验,ortho 样条线很少产生令人满意的结果。

    另一种选择是使用splines=polyline

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-10-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-29
      • 1970-01-01
      • 2013-07-14
      相关资源
      最近更新 更多