Linux command
dot 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Render graph to
dot -Tpng [graph.dot] -o [output.png]
Render to SVG
dot -Tsvg [graph.dot] -o [output.svg]
Render to PDF
dot -Tpdf [graph.dot] -o [output.pdf]
Render from stdin
echo "digraph { A -> B }" | dot -Tpng -o [output.png]
Use specific layout
dot -Kneato [graph.dot] -Tpng -o [output.png]
Render with custom
dot -Gdpi=[300] -Tpng [graph.dot] -o [output.png]
说明
dot is the primary program for rendering directed graphs from Graphviz. It reads graph descriptions in the DOT language and produces visual representations in various output formats. The DOT layout engine arranges nodes hierarchically, making it ideal for directed graphs like flowcharts, dependency diagrams, and state machines. Alternative engines (neato, fdp, circo) provide different layout algorithms. dot supports extensive customization through graph, node, and edge attributes controlling colors, shapes, fonts, and positioning.
参数
- -T_FORMAT_
- Output format: png, svg, pdf, ps, etc.
- -o _FILE_
- Output file name.
- -K_ENGINE_
- Layout engine: dot, neato, fdp, circo, twopi.
- -G_NAME=VALUE_
- Set graph attribute.
- -N_NAME=VALUE_
- Set default node attribute.
- -E_NAME=VALUE_
- Set default edge attribute.
- -V
- Print version.
FAQ
What is the dot command used for?
dot is the primary program for rendering directed graphs from Graphviz. It reads graph descriptions in the DOT language and produces visual representations in various output formats. The DOT layout engine arranges nodes hierarchically, making it ideal for directed graphs like flowcharts, dependency diagrams, and state machines. Alternative engines (neato, fdp, circo) provide different layout algorithms. dot supports extensive customization through graph, node, and edge attributes controlling colors, shapes, fonts, and positioning.
How do I run a basic dot example?
Run `dot -Tpng [graph.dot] -o [output.png]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -T_FORMAT_ do in dot?
Output format: png, svg, pdf, ps, etc.