【问题标题】:Add round feedback arrow to horizontal graph in Graphviz / DiagrammR在 Graphviz / DiagrammR 中向水平图添加圆形反馈箭头
【发布时间】:2021-08-16 22:21:24
【问题描述】:

我喜欢在 Graphviz 图表中添加一个反馈箭头,其中普通的“流”保持水平,但反馈应该是圆形的,就像下面手动添加的蓝色箭头一样。

这是我到目前为止所尝试的。我将 DiagrammR 包用于 R 语言,但建议使用普通或 python Graphviz,或者当然也会有所帮助。

library("DiagrammeR")
grViz("digraph feedback {
         graph [rankdir = 'LR']
           node [shape = box]
             Population
           node [shape = circle]
             Source Sink
           node [shape = none]
             Source -> Growth -> Population -> Death -> Sink
             
             Population -> Growth [constraint = false]
             Death -> Population [constraint = false]
}")

【问题讨论】:

    标签: r graphviz pygraphviz


    【解决方案1】:

    您可以尝试使用 headport 和 tailport 选项,并为这两个选项指定“北”(用于人口和增长)。

    headport 是箭头与节点相交的主要方向。

    尾端口是从节点发出尾部的基本方向。

    library("DiagrammeR")
    grViz("digraph feedback {
             graph [rankdir = 'LR']
               node [shape = box]
                 Population
               node [shape = circle]
                 Source Sink
               node [shape = none]
                 Source -> Growth -> Population -> Death -> Sink
                 Population -> Growth [tailport = 'n', headport = 'n', constraint = false]
    }")
    

    输出

    【讨论】:

    • 太棒了!谢谢@Ben!现在唯一剩下的装饰性问题是如何将圆形节点更改为有点类似于云符号。
    • 很高兴听到。云符号可能很难!我没有看到 grViz 可用的形状。我确实看到another example 使用三个八边形来表示云……不太一样。祝你好运!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-04
    • 1970-01-01
    • 2019-09-07
    • 2021-12-15
    • 2016-08-20
    • 2023-03-11
    相关资源
    最近更新 更多