Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 Windows, not linux)

like image 944
Nick Heiner Avatar asked Sep 29 '09 19:09

Nick Heiner


People also ask

How do I Visualise a .dot file?

If you are a Mac user simply looking to view a DOT file, you can use Apple Preview, which comes bundled with macOS. You can also upload DOT files to Google Docs, which is a free web and mobile (Android and iOS) application that allows you to view, edit, save, and convert the document.

How do you print on Graphviz?

After installing Graphviz, make sure that its bin/ subdirectory containing the dot layout command for rendering graph descriptions is on your systems' PATH (sometimes done by the installer; setting PATH on Linux, Mac, and Windows): On the command-line, dot -V should print the version of your Graphiz installation.


2 Answers

type: dot -Tps filename.dot -o outfile.ps

If you want to use the dot renderer. There are alternatives like neato and twopi. If graphiz isn't in your path, figure out where it is installed and run it from there.

You can change the output format by varying the value after -T and choosing an appropriate filename extension after -o.

If you're using windows, check out the installed tool called GVEdit, it makes the whole process slightly easier.

Go look at the graphviz site in the section called "User's Guides" for more detail on how to use the tools:

http://www.graphviz.org/documentation/

(See page 27 for output formatting for the dot command, for instance)

http://www.graphviz.org/pdf/dotguide.pdf

like image 113
Paul McMillan Avatar answered Sep 26 '22 00:09

Paul McMillan


dot -Tps input.dot > output.eps dot -Tpng input.dot > output.png 

PostScript output seems always there. I am not sure if dot has PNG output by default. This may depend on how you have built it.

like image 21
user172818 Avatar answered Sep 25 '22 00:09

user172818