How do I get DOT to display an image for a node?

后端 未结 2 2077
無奈伤痛
無奈伤痛 2020-12-15 04:23

I am not having success displaying an image at a node in dot.

My node is defined:

SW103 [image=\"swOpen.png\"]

I can view swO

相关标签:
2条回答
  • 2020-12-15 04:59

    Using a graphviz snapshot from May 2011 (2.29), the following syntax

    digraph g{
      imgnode[image="apple-touch-icon.png", label=""];
    }
    

    results in

    graphviz output

    You'll need to set an empty label to prevent the node name from being displayed.

    If this is not working for you, you may check the output of dot (something like dot -Tpng -o graph.png graph.gv) - if dot can't find the image, you should be able to see an error message.

    I did not have to specify any size (I think this is for svg).

    0 讨论(0)
  • 2020-12-15 05:00

    For one node you can use the below sample:

    xxx.node(SW103 , color='red', image="swOpen.png")
    

    It changed image of SW103 node.

    0 讨论(0)
提交回复
热议问题