How do I draw this diagram in tikz? Any pointers to the relevant libraries and packages are also welcome. In that case, it would be nice if you suggest a help file (similar examples) also?

enter image description here


2 Answers 2


Next time, please note that you should investigate solutions yourself and post an MWE which at least provides the framework of the document and, for example, the text for the nodes of your picture. (This is a lot easier than copying from an image for people who would like to help you.)

This answer uses forest to create the diagram as a tree. It uses shading to give a little depth to the nodes and the shadows library to enhance this effect. Two phantom children are used to help aligning the final nodes of the tree and the connecting lines to the first of these are added after the tree is complete since this node has four parents.

diagram as tree


\usetikzlibrary{arrows.meta, shapes.geometric, calc, shadows}


  rect/.append style={rectangle, rounded corners=2pt, inner color=col6in, outer color=col6out},
  ellip/.append style={ellipse, inner color=col5in, outer color=col5out},
  orect/.append style={rect, font=\sffamily\bfseries\LARGE, text width=325pt, text centered, minimum height=10pt, outer color=col7out, inner color=col7in},
  oellip/.append style={ellip, inner color=col8in, outer color=col8out, font=\sffamily\bfseries\large, text centered},
  for tree={
      line width=1pt,
      child anchor=north,
      parent anchor=south,
      drop shadow,
      l sep+=12.5pt,
      edge path={
        \noexpand\path[color=linecol, rounded corners=5pt, >={Stealth[length=10pt]}, line width=1pt, ->, \forestoption{edge}]
          (!u.parent anchor) -- +(0,-5pt) -|
          (.child anchor)\forestoption{edge label};
      where level={3}{tier=tier3}{},
      where level={0}{l sep-=15pt}{},
      where level={1}{
        if n={1}{
          edge path={
            \noexpand\path[color=linecol, rounded corners=5pt, >={Stealth[length=10pt]}, line width=1pt, ->, \forestoption{edge}]
              (!u.west) -| (.child anchor)\forestoption{edge label};
          edge path={
            \noexpand\path[color=linecol, rounded corners=5pt, >={Stealth[length=10pt]}, line width=1pt, ->, \forestoption{edge}]
              (!u.east) -| (.child anchor)\forestoption{edge label};
  [Compressed Sensing\\Theory, inner color=col1in, outer color=col1out
    [Projection Matrix\\Theory, inner color=col2in, outer color=col2out
      [Optimise Projection\\Matrix, inner color=col4in, outer color=col4out]
      [Reduce Number of\\Measurements, inner color=col4in, outer color=col4out]
    [Reconstruction\\Algorithms, inner color=col3in, outer color=col3out
      [Convex Relaxation
        [Sparse Signal\\Estimate, rect, name=sse1
      [Greedy Pursuits
        [Sparse Signal\\Estimate, rect, name=sse2
      [, phantom, calign with current
        [A\\B, phantom
          [Our Work, orect, name=us
            [{Improved Sparse Signal Estimate!}, oellip
      [Non-Convex\\Minimisation Methods
        [Sparse Signal\\Estimate, rect, name=sse3
        [Sparse Signal\\Estimate, rect, name=sse4
  \begin{scope}[color=linecol, rounded corners=5pt, >={Stealth[length=10pt]}, line width=1pt, ->]
    \draw (sse2.south) -- (us.north -| sse2.south);
    \draw (sse3.south) -- (us.north -| sse3.south);
    \coordinate (c1) at ($(sse1.south)!2/5!(sse2.south)$);
    \coordinate (c2) at ($(sse3.south)!2/5!(sse4.south)$);
    \draw (sse1.south) -- +(0,-10pt) -| (us.north -| c1);
    \draw (sse4.south) -- +(0,-10pt) -| (us.north -| c2);
  • Beautiful!! Your answer has inspired me to completely learn it :):) Jul 13, 2014 at 2:18
  • Hi, How do I make the left branch go from the north of the root and the right branch go from the south of the root. Jul 15, 2014 at 5:55
  • @dineshdileep The if level={1}{... code specifies what happens at the first level. You can see (!u.west) and (!u.east) in this code. !u refers to the parent (i.e. the root node in the case of the first level). So the east and west here are determining where the branches leave the root. Change this to alter the layout. However, I'm not clear what you want the path to do in that case since the image you posted features an east/west layout.
    – cfr
    Jul 15, 2014 at 14:29
  • @cfr: I have a similar question like dineshdileep. I had already posted it as a comment to Dan H.'s answer. I am re-posting it again so that I can change your figure. Can you suggest a method to change the two main children (labelled Projection matrix Theory and Reconstruction Algorithms) to position on the north and south of the root node (Compressed Sensing Theory)? That is, I would like the two main children nodes to open pout towards north and south of the root node. I tried your answer to dineshdileeep. But I found that it is only changing the starting position of the branches.
    – Sooraj
    Jul 15, 2014 at 23:06
  • @Sooraj Does the answer Dan H. gave to your comment not work for you? Otherwise, I suggest asking a new question. You can link this question from the new one and put a link in a comment here if you wish. But that would be a very different layout and can't easily be answered in a comment. (At least for this answer. The other answer is constructed differently which is why I suggest trying Dan H's response first.)
    – cfr
    Jul 16, 2014 at 1:37

Have a look at here: Texample - Simple Flow chart

Needed libraries, as in this example are \usetikzlibrary{shapes,arrows}.

Edit: Taken from Texample:


% Define block styles
\tikzstyle{decision} = [diamond, draw, fill=blue!20, text width=4.5em, text badly centered, node distance=3cm, inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, fill=blue!20, text width=5em, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse,fill=red!20, node distance=3cm, minimum height=2em]

\begin{tikzpicture}[node distance = 2cm, auto]
% Place nodes
\node [block] (init) {initialize model};
\node [cloud, left of=init] (expert) {expert};
\node [cloud, right of=init] (system) {system};
\node [block, below of=init] (identify) {identify candidate models};
\node [block, below of=identify] (evaluate) {evaluate candidate models};
\node [block, left of=evaluate, node distance=3cm] (update) {update model};
\node [decision, below of=evaluate] (decide) {is best candidate better?};
\node [block, below of=decide, node distance=3cm] (stop) {stop};
% Draw edges
\path [line] (init) -- (identify);
\path [line] (identify) -- (evaluate);
\path [line] (evaluate) -- (decide);
\path [line] (decide) -| node [near start] {yes} (update);
\path [line] (update) |- (identify);
\path [line] (decide) -- node {no}(stop);
\path [line,dashed] (expert) -- (init);
\path [line,dashed] (system) -- (init);
\path [line,dashed] (system) |- (evaluate);

Edit 2: In the specific case my code looks like that.

% Define block styles
\tikzstyle{block} = [rectangle, draw, text width=2.5cm, text centered, rounded corners, minimum height=4em,fill=blue!20]
\tikzstyle{line} = [draw,thick, -latex']
\tikzstyle{cloud} = [draw, ellipse, text width=2.5cm, text centered]
\tikzstyle{edge from parent}=[->,thick,draw]

\begin{tikzpicture}[auto,edge from parent fork down]
\tikzstyle{level 1}=[sibling distance=180mm,level distance=18ex] 
\tikzstyle{level 2}=[sibling distance=55mm,level distance=24ex] 
% Place nodes
\node [cloud,fill=red!40] (cst) {Compressed Sensing Theory}
child{node [cloud,fill=green!40] (pmt) {Projection Matrix Theory}
    child{node [cloud,fill=green!20] (opm) {Optimize Projection Matrix}}
    child{node [cloud,fill=green!20] (rnm) {Reduce Number of Measurements}}
child{node [cloud,fill=blue!40] (ra) {Reconstruction Algorithms}
    child{node [cloud,fill=blue!20] (cr) {Convex Relaxation}}
    child{node [cloud,fill=blue!20] (gp) {Greedy Pursuit}}
    child{node [cloud,fill=blue!20] (ncmm) {Non-Convex Minimization Methods}}
    child{node [cloud,fill=blue!20] (ca) {Combinatorial Algorithms}}
\node[block,yshift=-1cm,below of= cr](sse1){Sparse Signal Estimate};
\node[block,yshift=-1cm,below of= gp](sse2){Sparse Signal Estimate};
\node[block,yshift=-1cm,below of= ncmm](sse3){Sparse Signal Estimate};
\node[block,yshift=-1cm,below of= ca](sse4){Sparse Signal Estimate};
\node[below of= ra,yshift=-8cm,rectangle, draw, text width=16cm, text centered, rounded corners, minimum height=3em,fill=orange!40](ow){Our Work};
\node[below of= ow,yshift=-1cm,rectangle, draw, text width=8cm, text centered, rounded corners, minimum height=3em,fill=orange!20](isse){Improve Sparse Signal Estimate};
%% Draw edges
\path [line] (cr.south) -- (sse1.north);
\path [line] (gp.south) -- (sse2.north);
\path [line] (ncmm.south) -- (sse3.north);
\path [line] (ca.south) -- (sse4.north);
\path [line] (sse1)--($(sse1.south)-(0,0.5)$) -| (ow.175);
\path [line] (sse2)--($(sse2.south)-(0,0.5)$) -| (ow.150);
\path [line] (sse3)--($(sse3.south)-(0,0.5)$) -| (ow.30);
\path [line] (sse4)--($(sse4.south)-(0,0.5)$) -| (ow.5);
\path [line] (ow.south) -- (isse.north);


  • 2
    You could elaborate a little bit on your solution and making a full example out of it?
    – user31729
    Jul 11, 2014 at 7:48
  • @DanH. I am aware that you do not enough reputation at the moment to make comments, the more important it is to provide a good, qualified solution/answer, that earns you reputation ;-)
    – user31729
    Jul 11, 2014 at 8:21
  • Thanks to all your feedback, helping me getting used to the community. I'll give a shot on a customized example during the day.
    – Dan H.
    Jul 11, 2014 at 8:27
  • Thanks, this is great. Yes, I apologize for not putting a mwe Jul 13, 2014 at 2:19
  • Great figure! Can you suggest a method to change the two main children (labelled Projection matrix Theory and Reconstruction Algorithms) to position on the north and south of the root node (Compressed Sensing Theory)? That is, I would like the two main children nodes to open pout towards north and south of the root node.
    – Sooraj
    Jul 15, 2014 at 19:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .