2013-03-19 61 views
6

我试图使用graphviz的自定义图像节点graphviz的节点(节点d):使用PNG或SVG图像为

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 

我的代码,inclu dng png图片,is stored in github

如何在我的自定义图像上使用替换节点d

回答

6

只需限定其它形状此节点,例如shape=none

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

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

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

+1

作品,谢谢! https://github.com/adamatan/graphviz_linked_list/blob/master/list.png – 2013-03-19 14:59:37