LinuxCommandLibrary

dot

Visualize graphs described in DOT language

TLDR

Render a PNG image with a filename based on the input filename and output format (uppercase -O)

$ dot -T [png] -O [path/to/input.gv]
copy

Render a SVG image with the specified output filename (lowercase -o)
$ dot -T [svg] -o [path/to/image.svg] [path/to/input.gv]
copy

Render the output in PS, PDF, SVG, Fig, PNG, GIF, JPEG, JSON, or DOT format
$ dot -T [format] -O [path/to/input.gv]
copy

Render a GIF image using stdin and stdout
$ echo "[digraph {this -> that} ]" | dot -T [gif] > [path/to/image.gif]
copy

Display help
$ dot -?
copy

SYNOPSIS

dot [-V] [-ooutfile] [-Tformat] [-Gattr=value] [-Nattr=value] [-Eattr=value] [files]

PARAMETERS

-?
    Print usage information and exit.

-V
    Print version information and exit.

-o outfile
    Write output to outfile instead of stdout.

-T format
    Set output format (png, svg, pdf, ps, etc.).

-O
    Automatically generate output filenames based on input.

-P
    Use PostScript prologue for output.

-l libname
    Load shape library libname.

-n
    Run with no layout processing (for testing).

-q[quality]
    Set spline quality (0-3; higher is smoother).

-v
    Verbose output mode.

-K engine
    Use layout engine engine (default: dot).

-G attr=value
    Set graph attribute attr to value.

-N attr=value
    Set node attribute attr to value.

-E attr=value
    Set edge attribute attr to value.

DESCRIPTION

The dot command is a core component of the Graphviz toolkit, designed to layout and render directed graphs described in the DOT language. DOT is a plain-text graph description language that allows users to define nodes, edges, and attributes for visualizing hierarchies, networks, workflows, and more.

Dot processes input files (or stdin) containing DOT source, computes a hierarchical or layered layout using a force-directed algorithm optimized for directed acyclic graphs (DAGs), and outputs the result in various formats such as SVG, PNG, PDF, or PostScript. It excels at producing publication-quality diagrams with customizable node shapes, edge styles, colors, labels, and clusters.

Key strengths include automatic ranking of nodes into layers to minimize edge crossings, support for subgraphs (clusters), and spline-based edge routing. Users can influence layout via graph-, node-, and edge-specific attributes passed on the command line with -G, -N, and -E flags.

Common use cases span software engineering (call graphs, UML), biology (pathways), databases (ER diagrams), and web development (site maps). For non-directed graphs, other engines like neato may be preferable.

CAVEATS

Memory-intensive for graphs with >10k nodes/edges; may produce suboptimal layouts for cyclic or undirected graphs. Requires Graphviz installed. Some formats need external libs (e.g., png needs libgd).

COMMON EXAMPLE

dot -Tsvg graph.dot -o graph.svg
Renders graph.dot to SVG.

SUPPORTED FORMATS

Core: dot, canon, plain, ps, svg, png, pdf. Others via plugins: map, imap, cmapx.

HISTORY

Developed at AT&T Bell Labs starting in 1991 by John Guttag and others as part of the 'dot' system for program structure visualization. Evolved into Graphviz (1997+), open-sourced in 2000, now maintained by individual contributors post-AT&T. Widely used since 2000s in tools like Doxygen and PlantUML.

SEE ALSO

neato(1), twopi(1), circo(1), fdp(1), gvpr(1), dotty(1)

Copied to clipboard