[Latex] Use TikZ to draw a flowchart __latex

Source: Internet
Author: User

This article describes how to use the TIKZ macro package to draw a flowchart.

\usepackage{tikz}
\usetikzlibrary{arrows,shapes,chains}

Same as picture, also included in \begin{figure}...\end{figure}.

The drawing flowchart is divided into two steps, and the first step is to define the control style.

To give an example, define a rectangular box:

\tikzstyle{process} = [Rectangle, Minimum width = 3cm, Minimum height = 1cm, text centered, draw = black]

ID for process, type rectangle, min width 3cm, Minimum height 1cm, text centered, black color. The minimum width is defined here because the control is defined in practice, and the width and height are variable.

Another example of a definition arrow is similar in meaning, where-> represents an arrow--Represents a line:

\tikzstyle{Arrow2} = [thick, >= stealth]

All controls need to define the reuse, including rectangles, parallelogram shapes, and lines, arrows, and other connectors to be predefined.

After defining the control, place the control in the \begin{tikzpicture}[node distance = 1.5cm] ... \end{tikzpicture}. where node distance = 1.5cm indicates that the spacing of each box in the flowchart defaults to 1.5cm. Give an example of a place control.

\node (in1) [io]{};
\node (Pro1) [Startstop, below of=in1] {\small linear filter};
\node (in2) [Io, left of = in1, Xshift = -2.5cm]{\small brightness};
\coordinate [Label=left:{\small input image}] (A) at ( -1.5,0);

The first line represents the drop control, the control is named In1, and the control type is IO, which is defined earlier. This is the first control without specifying the drop location. The trailing curly brace is empty, indicating that there is no text in it.

The second row places the second control named Pro1, the control type is startstop, and the placement position is below the in1. Before indicating the default spacing of 1.5cm, the actual position is Pro1 placed at 1.5cm below in1. The text is linear filter, \small indicates that the font size is small.

The third row places a third control named In2, In1 to the left, with a default spacing of 1.5cm, but xshift=-2.5cm so that in2 is placed at 4cm on the left side of the in1. Where the text is brightness.

Line four indicates that the text is placed in ( -1.5,0) position and the text is an input image.
After placing the completion control, start placing the line.

\draw[arrow] (Pro1)--(in1);

Represents the line, the style of the lines is arrow, defined in the front, connecting Pro1 and in1.

Finally give an example of a flowchart. The original diagram of the flowchart is derived from Itti's significant paper. It basically contains all the points in the common flowchart.

Latex Code

\begin{Figure}[HTB] \centering% define shape styles \tikzstyle{startstop} = [Rectangle, rounded corners, minimum width = 3cm, minim Um height = 0.7cm, text centered, draw = black] \tikzstyle{Startstop2} = [Rectangle, rounded corners, minimum width = 13 CM, Minimum height = 0.7cm, text centered, draw = black] \tikzstyle{io} = [Trapezium, trapezium left angle = Trapezi Um Right angle = *, minimum width = 3cm, text centered, draw = black, fill = white] \tikzstyle{Io2} = [Trapezium, Trap  Ezium Left angle =-Trapezium Right angle = n, Minimum width = 2.5cm, draw = black, fill = white] \tikzstyle{Io3} = [Trapezium, trapezium Left angle =-Trapezium Right angle =, minimum width = 2cm, draw = black, fill = white] \tik zstyle{process} = [Rectangle, Minimum width = 3cm, Minimum height = 1cm, text centered, draw = black] \tikzstyle{Decisi on} = [Diamond, minimum width = 3cm, Minimum height = 1cm, text centered, draw = black] \tikzstyle{arrow} = [Thick,-, >= Stealth] \tikzstyle{Arrow2} = [thick, >= stealth] \begin{tikzpicture}[node distance = 1.5cm]% define flowchart specific Shape \coordinate[label =
Left:{\small input Image}] (A) at (-1.5, 0);
\node (in1) [IO] {};

\node (Pro1) [Startstop, below of = in1] {\small linear filter};
\node (in2-2) [Io3, below of = Pro1, yshift = -0.6cm]{};
\node (in3-2) [Io3, left of = in2-2, xshift = -2.5cm]{};

\node (in4-2) [Io3, right of = in2-2, xshift = 2.5cm]{};
\node (in2-1) [Io2, below of = Pro1, yshift = -0.3cm]{};
\node (in3-1) [Io2, left of = in2-1, xshift = -2.5cm]{};

\node (in4-1) [Io2, right of = in2-1, xshift = 2.5cm]{};
\node (in2) [Io, below of = Pro1] {\small color};
\node (in3) [Io, left of = in2, Xshift = -2.5cm]{\small Brightness};

\node (IN4) [Io, right of = in2, Xshift = 2.5cm]{\small Direction};

\node (IN5) [Startstop2, below of = in2-2]{\small center-surround difference calculation and normalization};
\node (in6-2) [Io3, below of = in5, yshift = -0.6cm]{};
\node (in7-2) [Io3, left of = in6-2, xshift = -2.5cm]{}; \node (in8-2) [Io3, right of = in6-2, Xshift =2.5cm]{};
\node (in6-1) [Io2, below of = in5, yshift = -0.3cm]{};
\node (in7-1) [Io2, left of = in6-1, xshift = -2.5cm]{};

\node (in8-1) [Io2, right of = in6-1, xshift = 2.5cm]{};
\node (IN6) [Io, below of = In5] {};
\node (in7) [Io, left of = in6, xshift = -2.5cm]{};

\node (IN8) [Io, right of = in6, xshift = 2.5cm]{};
\coordinate[label = Left:{\small feature Map}] (B) at (-1,-6.2);
\coordinate[label = Left:{\small (12 Zhang)}] (C) at (-1.5,-7.5);
\coordinate[label = Left:{\small (6 Zhang)}] (D) at (2.7,-7.5);

\coordinate[label = Left:{\small (24 Zhang)}] (E) at (6.7,-7.5);

\node (In9) [Startstop2, below of = in6-2]{\small Trans-scale merging and normalization};
\node (IN10) [Io, below of = In9] {};
\node (in11) [Io, left of = in10, xshift = -2.5cm]{};

\node (IN12) [Io, right of = in10, xshift = 2.5cm]{};
\coordinate[label = Left:{\small Eye-catching figure}] (F) at (-1,-9.5);
\node (IN13) [Startstop, below of = In10] {\small linear combination};
\node (IN14) [Io, below of = In13] {};

\coordinate[label = Left:{\small Significant figure}] (G) at (-1,-13); \node (IN15) [Startstop, belowof = In14] {\small winner takes full};
\coordinate[label = left:{\small Significant position}] () at (1,-16.1);

\coordinate[label = left:{\small Feedback Suppression}] () at (4.5,-14.7);
% Wired \draw[arrow] (Pro1)--(in1);
\draw[arrow] (Pro1)--(in2);
\draw[arrow] (Pro1)--(in3);
\draw[arrow] (Pro1)--(IN4);
\draw[arrow] (0, -4.75)--(in2-2);
\draw[arrow] ( -4, -4.75)--(IN3-2);
\draw[arrow] (4, -4.75)--(IN4-2);
\draw[arrow] (0, -5.45)--(IN6);
\draw[arrow] ( -4, -5.45)--(in7);
\draw[arrow] (4, -5.45)--(IN8);
\draw[arrow] (0, -8.35)--(IN6-2);
\draw[arrow] ( -4, -8.35)--(IN7-2);
\draw[arrow] (4, -8.35)--(IN8-2);
\draw[arrow] (0, -9.05)--(IN10);
\draw[arrow] ( -4, -9.05)--(IN11);
\draw[arrow] (4, -9.05)--(IN12);
\draw[arrow] (IN13)--(IN10);
\draw[arrow] (IN13)--(IN11);
\draw[arrow] (IN13)--(IN12);
\draw[arrow] (IN13)--(IN14);
\draw[arrow] (IN14)--(IN15);
\draw[arrow] (IN15)--(0,-15.8);
\draw[arrow] (0,-15.4)--(2.5,-15.4);
\draw[arrow] (2.5,-14)--(2.5,-15.4);
\DRAW[ARROW2] (2.5,-14)--(0,-14); \end{TIKZPIcture} \caption{It algorithm process \cite{Itti} \end{Figure} 

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.