4

Please help me to make this diagram with TikZ. Here's the code I've been trying to write for 3 days. Help me, it's urgent for my report. Best regards!

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english, frenchb]{babel}
\usepackage{ucs}
\usepackage{smartdiagram}
\usepackage{pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps,pgfshade}
\usepackage{lmodern}

\tikzset{
  basic/.style  = {draw, text width=12em, drop shadow, font=\sffamily, rectangle},
  root/.style   = {basic, rounded corners=2pt, thin, align=center,
                   fill=cyan!30},
  level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=cyan!60,
                   text width=8em},
  level 3/.style = {basic, thin, align=left, fill=pink!60, text width=6.5em}
}

\begin{document}
\begin{tikzpicture}[
  level 1/.style={sibling distance=40mm},
  edge from parent/.style={->,draw},
  >=latex]

% root of the the initial tree, level 1
\node[root] {Indicateur \mbox{d'insécurité} alimentaire}
% The first level, as children of the initial tree
  child {node[level 2] (c1) {SCA}}
  child {node[level 2] (c2) {PDA}}
  child {node[level 2] (c3) {ISS}};

% The second level, relatively positioned nodes
\begin{scope}[every node/.style={level 3}]

\node [below of = c2, xshift=20pt, text width=6cm, draw](c21) {Cartographie de \mbox{l’insécurité} alimentaire};

\node [below of = c21, xshift=20pt, text width=4cm, draw](c22) {Analyse statistique bivariée};

\node [below of = c22, xshift=20pt, text width=4cm, draw](c23) {ACM suivie d'une CAH};

\node [below of = c23, xshift=20pt, text width=2cm, draw](c25) {GLOGIT2};

\end{scope}


\end{tikzpicture}
\end{document}

enter image description here

5
  • Welcome to TeX.SX! You seem to have made a good start with your diagram, what is stopping you from completing it? Do you want the xshift=20pt option in the level 3 nodes, it's shifting the successive levels to the right, which looks a bit odd
    – Dai Bowen
    Jan 16, 2017 at 15:04
  • Hi Mrs. Bowen, I was wrong with the option "xshift = 20pt". In fact, I wanted to reproduce exactly what is on the picture. Please help me, I'm just a debater. I removed this "xshift = 20pt" node. But I have not yet managed to reproduce exactly what is on the picture.
    – Clairant
    Jan 16, 2017 at 15:26
  • Just for info, to ping another user you have to write @ followed by the nickname of the user, for example @DaiBowen
    – CarLaTeX
    Jan 16, 2017 at 15:36
  • @Clairant I get that you want to replicate the diagram but I don't really want to try and write all the code to do that for you. If there's a more abstract question you have about doing something in TikZ then that I'm keen to help with that. You've written (or obtained) some code which is posted, what's stopping you from adding more code to further improve your diagram by yourself? If you can explain that then I or somebody else will be more likely to want and be able to help with how to do what is holding you back.
    – Dai Bowen
    Jan 16, 2017 at 15:53
  • 1
    Thanks @DaiBowen for your answer. Actually, I just wanted you to help me connect the arrows and add the ellipses to the right. Sorry to disturb you. Cordially !
    – Clairant
    Jan 16, 2017 at 16:07

1 Answer 1

3

Not finished, but you can continue from following code:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english, frenchb]{babel}
\usepackage{ucs}
\usepackage{smartdiagram}
%\usepackage{positioning, pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps,pgfshade}
\usepackage{lmodern}

\tikzset{
  basic/.style  = {draw, text width=12em, drop shadow, font=\sffamily, rectangle},
  root/.style   = {basic, rounded corners=2pt, thin, align=center,
                   fill=cyan!30},
  level 2/.style = {basic, rounded corners=6pt, thin, align=center, fill=cyan!60,
                   text width=4em},
  level 3/.style = {basic, thin, align=center, fill=pink!60, text width=6.5em}
}

\begin{document}
\begin{tikzpicture}[font=\sffamily,
  level 1/.style={sibling distance=30mm},
  edge from parent/.style={->,draw},
  >=latex]

% root of the the initial tree, level 1
\node[root] (c) {Indicateur \mbox{d'insécurité} alimentaire}
% The first level, as children of the initial tree
  child {node[level 2] (c1) {SCA}}
  child {node[level 2] (c2) {PDA}}
  child {node[level 2] (c3) {ISS}};

% The second level, relatively positioned nodes
\begin{scope}[every node/.style={level 3}]

\node [below = of c2, text width=6cm, draw](c21) {Cartographie de \mbox{l’insécurité} alimentaire};

\node [below = of c21, text width=4cm, draw](c22) {Analyse statistique bivariée};

\node [below = of c22, text width=4cm, draw](c23) {ACM suivie d'une CAH};

\node [below = of c23, text width=2cm, draw](c24) {GLOGIT2};

\end{scope}

\foreach \i/\j in {c2/c21, c21/c22, c23/c24}
\draw[cyan, line width=1mm, >=latex, shorten >=.5mm, shorten <=1mm, ->] (\i)--(\j);

\begin{scope}[every node/.style={text width=4cm, ellipse, draw, align=center,
font=\sffamily, top color=white, bottom color=black!40}]

\node[right = 2cm of c] (d1) {Estimer le niveau d'insécurité alimentaire};

\node (d2) at (c21-|d1) {Où sont les ménages en insécurité alimentire?};

\path (c22)--coordinate (aux) (c23) ;

\node (d3) at (aux-|d1) {Caractériser les ménages eninsécurité alimentaire};

\node (d4) at (c24-|d1) {Analyser les déterminants de l'insécurité alimentire};
\end{scope}

\begin{scope}[line width=.5mm, >=latex, shorten >=1mm, shorten <=1mm, ->]
\draw (c) -- (d1);
\draw (c21) -- (d2);
\draw (c22.east) --++(0:5mm)|- (d3);
\draw (c23.east) --++(0:5mm)|- (d3);
\draw (c24) -- (d4);
\end{scope}

\end{tikzpicture}
\end{document}

enter image description here

1
  • Waoh ! @lgnasi thank you very much. Best regards.
    – Clairant
    Jan 16, 2017 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.