【问题标题】:Using png or svg image as graphviz node使用 png 或 svg 图像作为 graphviz 节点
【发布时间】:2013-03-08 07:13:06
【问题描述】:

我尝试在 graphviz 中使用自定义图像节点(节点 d):

digraph foo {
    rankdir=LR;
    node [shape=record];
    a [label="{ <data> 12 | <ref>  }", width=1.2]
    b [label="{ <data> 99 | <ref>  }"];
    c [label="{ <data> 37 | <ref>  }"];
    d [image="X_Shape_Pillar_Yellow.png"];
    a:ref:c -> b:data [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false, arrowsize=1.2];
    b:ref:c -> c:data [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false];
    c:ref:c -> d      [arrowhead=vee, arrowtail=dot, dir=both, tailclip=false];
}

很遗憾,图片没有出现:

我使用以下方法编译了点文件:

dot -v -Tpng list.dot -o list.png

我的代码,包括 png 图片,is stored in github

如何将替换节点 d 与我的自定义图像一起使用?

【问题讨论】:

    标签: image macos svg png graphviz


    【解决方案1】:

    只需为此节点定义其他形状,例如shape=none

    d [shape=none, label="", image="X_Shape_Pillar_Yellow.png"];
    

    默认定义的record 形状不显示图像,而nonebox 甚至plaintext 可以。

    同时,将标签设置为空可能是个好主意。

    【讨论】:

    猜你喜欢
    • 2018-09-23
    • 2020-01-03
    • 2013-07-01
    • 2019-12-09
    • 1970-01-01
    • 1970-01-01
    • 2011-06-16
    • 2021-11-03
    相关资源
    最近更新 更多