image - 使用 png 或 svg 图像作为 graphviz 节点

标签 image macos svg png graphviz

我尝试在 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];
}

不幸的是,图像没有出现:

enter image description here

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

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

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

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

最佳答案

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

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

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

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

关于image - 使用 png 或 svg 图像作为 graphviz 节点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15502427/

相关文章:

c++ - 显示图像 Sprite 中的特定图像

python - (2 n) 使用 Python 的视觉密码学

objective-c - imageRectForBounds 未在 NSButtonCell 子类中调用

css - SVG 剪辑路径不适用于 Safari

css - 有没有办法让 Batik 与 CSS3 样式兼容?

c++ - 单个 RGB 图像的压缩(使用 c++)

java - 从 Java 中的图像的一部分创建图像?

macos - 在 Swift 中有条件地在 TableView 中显示 ImageView

objective-c - 在 Interface Builder 中更改窗口标题

svg - 如何获得 SVG 组元素的高度/宽度?