Ubuntu16.04 Use Graphviz Paint

Source: Internet
Author: User
installation
sudo apt install Graphviz graphviz-doc
Drawing

The Graphviz contains 3 elements, graphs, vertices, and edges. Each element can have its own attributes that define the font, style, color, shape, and so on. Here are some simple examples to help us quickly understand the basic usage of Graphviz. The first picture of Graphviz

Create a new file, people named Try.dot, the contents of the document are as follows:

digraph G {
    main-> parse-> execute;
    Main-> init;
    Main-> cleanup;
    Execute-> make_string;
    Execute-> printf
        init-> make_string;
    Main-> printf;
    Execute-> compare;
}

Enter the following command in the terminal:

Dot-tpng Try.dot-o Try.png

A picture, named Try.png, is generated, as shown in the image below.
Supported picture formats

See the official website, almost all format pictures can be generated. The command to generate a picture in XX format is:

Dot-txx Filename-o output_filename.xx
Chinese Display

Need to complete the following two points at the same time: 1. Modify node and Edge FontName attributes to Fangsong, or other installed Chinese fonts (SimSun, etc.); 2. The file is set to UTF8 encoding.
For example, the following code

    digraph dataaccesslayer {  
        node[fontname= "Fangsong"];  
        Edge[fontname= "Fangsong"];  
        input [shape=box,label= "Enter text"];
        semanticparsenetwork [shape=box,label= "Semantic engine network"];
        Input-> semanticparsenetwork;
    }  

Generate the following picture:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.