使用 TikZ 的图表和子项

使用 TikZ 的图表和子项

请帮我用 TikZ 制作这个图表。这是我花了三天时间编写的代码。帮帮我吧,这对我的报告来说很紧急。此致!

\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

答案1

尚未完成,但您可以从以下代码继续:

\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

相关内容