dot drawing

dot drawing
python drawing graphviz

dot

DOT is a textual graphics description language. DOT language files usually have a .gv or .dot file extension. Of course, after writing . dot or . gv files, special programs are needed to process these files and render them into pictures. dot is one of these programs, which can render graphics described in DOT language into . png, . jpg, .pdf and many other types.

Of course, as a tool, dot itself is very primitive, just like gcc is to c code and g++ is to cpp code. Maybe some programmers are keen to use these tools in the terminal, but there are also many people who like interactive interfaces. , so there are tools such as gvedit, which provides an interactive window to render graphics described in the DOT language using tools such as dot.

graphviz

graphviz is an open source software package in which tools such as dot and gvedit mentioned above are included.
Therefore, we might as well simply think that DOT is a graphics description language and graphviz is an integrated tool for processing files in this language.

Environment configuration

Reference: graphviz

windows

Download the exe and install it

ubuntu

sudo apt-get install graphviz

Version view

windows

dot --version

The output information is as follows

dot - graphviz version 9.0.0 (20230911.1827)

ubuntu

dot -version

The output information is as follows

dot - graphviz version 2.43.0 (0)
libdir = "/usr/lib/x86_64-linux-gnu/graphviz"
Activated plugin library: libgvplugin_dot_layout.so.6
Using layout: dot:dot_layout
Activated plugin library: libgvplugin_core.so.6
Using render: dot:core
Using device: dot:dot:core
The plugin configuration file:
        /usr/lib/x86_64-linux-gnu/graphviz/config6a
                was successfully loaded.
    render      :  cairo dot dot_json fig gd json json0 map mp pic pov ps svg tk visio vml vrml xdot xdot_json
    layout      :  circo dot fdp neato nop nop1 nop2 osage patchwork sfdp twopi
    textlayout  :  textlayout
    device      :  canon cmap cmapx cmapx_np dot dot_json eps fig gd gd2 gif gv imap imap_np ismap jpe jpeg jpg json json0 mp pdf pic plain plain-ext png pov ps ps2 svg svgz tk vdx vml vmlz vrml wbmp webp x11 xdot xdot1.2 xdot1.4 xdot_json xlib
    loadimage   :  (lib) eps gd gd2 gif jpe jpeg jpg png ps svg webp xbm

Simple example

Create a new test.dotfile and enter the following content

digraph G
{
    
    
    a -> b;
}

Use the following command to generate pngimages

dot -Tpng -o test.png test.dot

The generated picture is as follows
Insert image description here

vscode plugin

Graphviz (dot) language support for Visual Studio Code

Insert image description here

reference

https://www.graphviz.org/pdf/dotguide.pdf
https://graphviz.org/gallery/
https://frapples.github.io/articles/2016-11-16-1f70.html
https://www.cnblogs.com/alenoscar/p/6064737.html

Guess you like

Origin blog.csdn.net/tyustli/article/details/133355119