【问题标题】:How can I combine rank=same with dir=back, while specifying ports?如何在指定端口时将 rank=same 与 dir=back 结合使用?
【发布时间】:2022-02-11 04:55:16
【问题描述】:

我有一个图表,它使用HTML-like labels 创建表格,其中一些单元格通过边连接。

这很好用,但是当我为两个节点指定rank=same,为连接边指定dir=back 并且至少一个port position 时,边的方向不受尊重。

这显示了example

digraph so {
    // This all works
    a -> b [label="Regular direction" dir="forward"]
    c -> d [label="Reverse direction", dir="back"]
    e:w -> f:w [label="Reverse direction\n + port choice", dir="back"]
    g -> h [label="Reverse direction\n + rank=same", dir="back"]
    {rank=same; g; h}
    
    // This fails
    i:s -> j [label="Reverse direction\n + port choice\n + rank=same", dir="back"]
    {rank=same i; j}
}

我在下面强调了失败的部分:

是否有图形/节点/边选项的组合可以让我在两个节点处于同一等级时从一个节点端口绘制反向边?

我尝试过的

我没有在边缘使用dir=back,而是尝试将arrowhead=none and arrowtail=normaldir=both 结合使用。 didn't work either 甚至以某种方式影响了 i -> j 边缘。

digraph so {
    // This fails
    i:s -> j [label="Reverse direction\n + port choice\n + rank=same", dir="back"]
    {rank=same i; j}
    
    // This fails
    k:s -> l [label="Reverse direction\n + port choice\n + rank=same\n + arrowhead/tail", arrowhead=none, arrowtail=normal, dir="both"]
    {rank=same k; l}
}

【问题讨论】:

    标签: graphviz dot


    【解决方案1】:

    我发现在label 属性之前提及dir 属性可以得到你想要的:

    digraph so {
        i:s -> j [dir="back", label="Reverse direction\n + port choice\n + rank=same"]
        {rank=same; i;j}
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-08-08
      • 2019-04-05
      • 2016-08-16
      • 1970-01-01
      • 2022-10-24
      • 1970-01-01
      • 2021-08-04
      • 1970-01-01
      相关资源
      最近更新 更多