Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using png or svg image as graphviz node

I've tried to use a custom image node in graphviz (node 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];
}

Unfortunately, the image does not appear:

enter image description here

I've compiled the dot file using:

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

My code, including the png image, is stored in github.

How do I use a replace node d with my custom image?

like image 955
Adam Matan Avatar asked Mar 19 '13 14:03

Adam Matan


1 Answers

Simply define an other shape for this node, for example shape=none:

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

The record shape defined as default does not display the image, whereas none, box and even plaintext do.

At the same time, it may be a good idea to set the label to nothing.

like image 144
marapet Avatar answered Oct 06 '22 10:10

marapet