Graphviz: How to go from .dot to a graph?

后端 未结 11 1479
傲寒
傲寒 2020-11-27 08:44

I can\'t seem to figure this out. I have a .dot file, which is valid according to the syntax. How do I use graphviz to convert this into an image?

(note that I\'m on

11条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 09:14

    This should combine a lot of answers.

    # Convert dot to png via graphviz
    dot -Tpng filename.dot -o filename.png
    
    # Convert dot to svg via graphviz
    dot -Tsvg filename.dot -o filename.svg
    
    # Convert dot to eps via graphviz
    dot -Tps filename.dot -o filename.eps
    

    Keep in mind that on OSX (MAC), you need to install homebrew to install graphviz to be able to use the dot commands above.

    brew install graphviz
    

    It is also possible to install Graphviz (and use the commands above) through the package manager functionality of conda if you have Anaconda installed.

    conda install python-graphviz
    

提交回复
热议问题