Skip to content

How to view or work with Graphviz Dot files

Olzhas Rakhimov edited this page Jul 18, 2018 · 3 revisions

Requirements

  1. Graphviz
  2. (Optional) xdot

Graph View

To view the generated graph dot files without converting to other formats.

$ xdot graph.dot

Graph to Image Conversion

Here's how to convert a Graphviz dot file to PDF format.

$ dot -Tpdf graph1.dot -o graph1.pdf

Apply -O flag to automatically generate output file names from the input file names.

$ dot -T pdf graph1.dot -O  # The output file is graph1.dot.pdf

To run dot on files in directories and sub-directories recursively.

$ find directory_path -type f -name "*.dot" | xargs dot -Tpdf -O

To create output file names without .dot in the name.

$ find directory_path -type f -name "*.dot" -exec sh -c 'dot -Tpdf "${0}" -o "${0%.*}.pdf"' {} \;
You can’t perform that action at this time.