# Simplest flowchart using TikZ

I would like to have a very simple flowchart using TikZ.

I would very much appreciate if you provide a simple code for this.

For a color, a black and white is fine.

For example, the following is a simple one. But I would like to have blocks of the same width regardless of the text.

\tikzstyle{block} = [draw,rectangle,thick,minimum height=2em,minimum width=2em] \tikzstyle{line} = [draw, very thick, color=black!50, -latex']
\begin{tikzpicture}[node distance = 2cm, auto]
\node [block] (init) {initialize model};
\node [block, below of=init] (expert) {expert};
\path [line] (init) -- (expert);
\end{tikzpicture}


• What have you tried so far? Please add an MWE. Moreover, just search around: texample.net/tikz/examples/simple-flow-chart – CarLaTeX Aug 27 '17 at 18:48
• For example, a following is a simplest one. But I would ike to have a block to have the same width regardless of the text. \tikzstyle{block} = [draw,rectangle,thick,minimum height=2em,minimum width=2em] \tikzstyle{line} = [draw, very thick, color=black!50, -latex']\begin{tikzpicture}[node distance = 2cm, auto] \node [block] (init) {initialize model}; \node [block, below of=init] (expert) {expert}; \path [line] (init) -- (expert); \end{tikzpicture} – user12586 Aug 27 '17 at 18:59
• For the future, don't put your example as a comment but edit your question (I've already done it for you). – CarLaTeX Aug 27 '17 at 19:09
• And please post complete code we can compile ;). (With a \documentclass{} etc.) – cfr Aug 27 '17 at 23:30

Use tikzset instead of tikzstyle, see here: Should \tikzset or \tikzstyle be used to define TikZ styles?.

Use below=... of instead of below of=, this way you can also set the distance between the nodes.

To have all the blocks with the same size use text width=10em or whatever width you prefer.

If you want to shift the line between the two blocks, you could use xshift=....

If you want a big arrow, change line width=..., and, if you want to shorten it, use shorten >=... for the tip and shorten <=... for the tail.

As cfr told you, don't use arrows but arrows.meta, you can also change the aspect of the arrow tip with [length=..., width=...]. I've choosen Triangle because is similar to the image you posted, but you could choose also Stealth or Latex.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, positioning}
\tikzset{%
block/.style = {draw=cyan,rectangle,thick,
minimum height=2em, text width=10em, align=center},
line/.style = {draw=cyan, line width=4pt,
-{Triangle[length=10pt, width=10pt]}, shorten >=2pt, shorten <=2pt},
}

\begin{document}
\begin{tikzpicture}[node distance = 2cm, auto]
\node [block] (init) {initialize model};
\node [block, below=30pt of init] (expert) {expert};
\path [line] (init) -- (expert);
\node [block, below=30pt of expert] (third) {third};
\path [line] ([xshift=-1em]expert.south) -- ([xshift=-1em]third.north);
\node [block, below=30pt of third] (fourth) {fourth};
\path [line] ([xshift=1em]third.south) -- ([xshift=1em]fourth.north);
\end{tikzpicture}
\end{document}


• Thank you. As last questions, how can I get arrow for the line connecting two blocks? Is it possible to change the location of the line between two blocks? (that is, not at the center of a block but like 2cm from the left end of the block.) – user12586 Aug 27 '17 at 19:28
• @user12586 If you intended a big arrow, see my renewed answer. – CarLaTeX Aug 27 '17 at 20:07
• @user12586 arrows is deprecated. Use arrows.meta and e.g. Stealth instead. – cfr Aug 27 '17 at 23:32
• @cfr You're right, I used arrow because there was -latex' in the OP's code snippet. I'll correct my answer asap. – CarLaTeX Aug 28 '17 at 1:20
• @cfr Corrected! :) – CarLaTeX Aug 28 '17 at 5:38