# TikZ: Flow Chart

Kindly help this messy tikz flow chart.

\documentclass{beamer}
\usetheme{CambridgeUS}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\tikzstyle{block} = [rectangle, draw, text width=10em, text centered, fill=yellow!80]
\tikzstyle{mycircle} = [circle, draw, text width=7em, text centered, fill=red!30]
\begin{document}
\begin{frame}
\begin{tikzpicture}[node distance=4.5cm, auto, >=stealth]
\centering
\node [block](child){\par {Early life{\begin{itemize}
\item Genetic
\item Environmental
\end{itemize}}}};

\node [block] (psych)[right of = child]{\large {Psychoscial factors}{\begin{itemize}
\item life stress
\item Psychological stress
\item coping
\item social support
\end{itemize}}};

\node [block](physiology)[below of = psych]{Physiology {\begin{itemize}
\item Motility
\item Sensation
\item Inflammation
\item Altered bacterial
\item flora
\end{itemize}}};

\node [mycircle](FGID)[right of = physiology]{FGID};
%path
\draw[->](child)--(psych);
\draw[->] (child)--(physiology);
\draw[<->](psych)--(physiology);
\draw [<->](physiology)--(FGID);
\draw [<->](psych)--(FGID);
\end{tikzpicture}
\end{frame}
\end{document}


-
You shouln’t create a style circle which uses the shape circle. Either use a different name or or use circle/.style={shape=circle}. Also relevant: Should \tikzset or \tikzstyle be used to define TikZ styles? and Difference between "right of=" and "right=of" in PGF/TikZ. \large doesn’t take an argument, the correct use would be {\large Physoscial factors}. <--> isn’t correct. (Do you mean <->?) – Qrrbrbirlbel Aug 9 '13 at 17:41
edited to include your suggestion. did not understand the difference between right of= and right=of – Vaibhav Aug 9 '13 at 18:13

Besides the things I already commented on, here are a few other things I’d consider:

Setting a fixed with makes the nodes having them the same width but also creates problem for very long words in the itemize environment. In addition to that the itemize environment introduces a rather high horizontal white space in front of the bullet. (Similar things happen in Saving a list in a re-usable box.)

I would avoid itemize and reproduce the behavior with a simply tabular environment (see my answer on the linked question) which inserts the bullet on its own.

For a more pleasing output I center the first line (kind of a header, isn’t it?) and add additional vertical space. The rectangle split shape might help here.

The needed options are:

• shape=rectangle split,
• rectangle split parts=2: we want two parts,
• rectangle split part align={center,left}: the first part is centered, the second part is left-aligned.
• rectangle split draw splits=false: by default the shape has lines between the separate parts, this disables them.

In the second example, I have used my positioning-plus library to place the psych and the FGID node vertically centered to the other nodes.

The first example needs the positioning library (which is loaded by positioning-plus so it is not loaded explicitly).

## Code

\documentclass{beamer}
\usepackage{tikz,array}
\usetikzlibrary{positioning-plus,arrows,shapes.multipart}
\tikzset{
block/.style={
shape=rectangle split,
draw,
rectangle split part align={center,left},
rectangle split parts=2,
rectangle split draw splits=false},
Circle/.style={shape=circle, draw, align=left}}
\newcommand*{\itemizeTabular}[2][l]{%
\begin{tabular}{!{\kern\tabcolsep\usebeamertemplate{itemize item}}#1@{}}#2\end{tabular}}
\begin{document}
\begin{frame}\centering
\begin{tikzpicture}[auto, thick, >=stealth]
\node[block] (child) {%
Early life\nodepart{two}
\itemizeTabular{Genetic\\Environmental}};
\node[block, right=of child] (psych) {%
Psychoscial factors\nodepart{two}
\itemizeTabular{life stress\\Psychological stress\\coping\\social support}};
\node[block, below=of psych] (phys) {%
Physiology\nodepart{two}
\itemizeTabular{Motility\\Sensation\\Inflammation\\Altered bacterial\\flora}};

\node[Circle, right=of phys](FGID) {FGID};

\path[->] (child) edge (psych)
edge (phys);
\path[<->] (psych) edge (phys)
edge (FGID)
(phys) edge (FGID);
\end{tikzpicture}
\end{frame}
\begin{frame}\centering
\begin{tikzpicture}[auto, thick, >=stealth]
\node[block] (psych) {%
Psychoscial factors\nodepart{two}
\itemizeTabular{life stress\\Psychological stress\\coping\\social support}};
\node[block, below=of psych] (phys) {%
Physiology\nodepart{two}
\itemizeTabular{Motility\\Sensation\\Inflammation\\Altered bacterial\\flora}};

\node[block,left=of (phys)(psych)] (child) {%
Early life\nodepart{two}
\itemizeTabular{Genetic\\Environmental}};

\node[Circle, right=of (phys)(psych)](FGID) {FGID};

\path[->] (child) edge (psych)
edge (phys);
\path[<->] (psych) edge (phys)
edge (FGID)
(phys) edge (FGID);
\end{tikzpicture}
\end{frame}
\end{document}


## Output

-
Would you like to comment out what these terms mean? rectangle split part align={center,left}, rectangle split parts=2, rectangle split draw splits=false}, Also on the difference between right=of and right of= – Vaibhav Aug 9 '13 at 18:19
How can I put a text "Gut brain interaction " around arrow between psychosocial and physiology – Vaibhav Aug 9 '13 at 18:22
is there a difference in ()--() and () edge() – Vaibhav Aug 9 '13 at 18:23
@user34083 -- and edge are very different. For once, -- only draws a straight line whereas edge works with the same options as to. Furthermore, edges are drawn separately (there are better examples to show this). \path (a) edge (b) edge (c); actually draws a line from (a) to (b) and from (a) to (c) (not from (b) to (c)). — How should the text Gut brain interaction be placed? – Qrrbrbirlbel Aug 9 '13 at 21:55
Gut brain interaction -vertically along the edge between physiology and psychosocial factors – Vaibhav Aug 10 '13 at 2:13