2

how can I draw something like this in Latex? enter image description here

Here is my actual Code

  \begin{tikzpicture}[node distance=.6cm,
  start chain=going below,]
  \node[punktchain, join] (Roh) {Rohdaten};
  \node[punktchain, join] (extraktion) {Merkmalsextraktion};
  \node[punktchain, join] (selektion) {Merkmalsselektion};
  \node[above=3mm of Roh.north west] (l) {Vorbereitung};
  \end{tikzpicture}

Any help would be appreciated. Thank you

2

Welcome to TeX-SE! Here is a proposal. Please try in the future to provide us with complete examples that start with \documentclass and end with \end{document}. In this case I had to guess how punktchain could be defined and type in texts from a screen shot. As for the teXnical aspects, one can use local bounding boxes and fit to draw the border around the groups.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{chains,fit}
\begin{document}
\begin{tikzpicture}[node distance=.6cm,punktchain/.style={minimum width=4cm,
 draw,thick,on chain,text height=2ex,text depth=0.3ex},every join/.style={-latex,thick},font=\sffamily]
 \begin{scope}[local bounding box=all]
  \begin{scope}[start chain=going below,local bounding box=L]
   \node[punktchain] (Roh) {Rohdaten};
   \node[punktchain, join] (extraktion) {Merkmalsextraktion};
   \node[punktchain, join] (selektion) {Merkmalsselektion};
   \node[above=3mm of Roh.north,node font=\bfseries\large] (Vor) {Vorbereitung};
  \end{scope} 
  \begin{scope}[start chain=going below,local bounding box=M,xshift=5.5cm]
   \node[punktchain] (PaTu) {Parameter Tuning};
   \node[punktchain, join] (ProMo) {Prototypmodell};
   \node[punktchain, join] (Off) {Offline--Evaluation};
   \node[above=3mm of PaTu.north,node font=\bfseries\large] (Klass) {Klassifikation};
  \end{scope} 
  \begin{scope}[start chain=going below,local bounding box=R,xshift=11cm]
   \node[punktchain] (Ein) {Einsatzmodell};
   \node[punktchain, join] (On) {Online--Evaluation};
   \node[above=3mm of Ein.north,node font=\bfseries\large] (Inb) {Inbetriebnahme};
  \end{scope} 
 \end{scope} 
 \foreach \X in {L,M,R}
 {\node[fit=(all.south-|\X.west) (all.north-|\X.east),
 draw,very thick,inner xsep=1ex,inner ysep=2ex] (fit-\X) {};}
 \draw[-latex,thick] (extraktion-|fit-L.east) -- (ProMo-|fit-M.west);
 \draw[latex-,thick] (selektion-|fit-L.east) -- (Off-|fit-M.west);
 \draw[-latex,thick] (ProMo-|fit-M.east) -- (On-|fit-R.west);
\end{tikzpicture}
\end{document}

enter image description here

2

with use of two chains:

  • horizontal (A going right) for group names
  • vertical (B going below) for text in boxes

and three nodes styles:

  • box for text in boxes
  • unbox for group names
  • FIT for groups

that i didn't need to retype nodes contents as base in solution development i used @marmot answer:

\documentclass[tikz,margin=3mm]{standalone}
\usetikzlibrary{arrows.meta,
                chains,
                fit,
                positioning}
\makeatletter
\tikzset{suspend join/.code={\def\tikz@after@path{}}} % for suspend joins between group contents
\makeatother

\begin{document}
    \begin{tikzpicture}[
node distance = 4mm and 12mm,
  start chain = A going right,
  start chain = B going below,
  base/.style = {minimum width=32mm, text depth=0.25ex,
                 on chain=#1},
   box/.style = {base=B,
                 draw, semithick, node font=\sffamily,
                 join},
   FIT/.style = {draw, thick,
                 node contents={},
                 inner ysep=1ex,
                 fit=#1},
 unbox/.style = {base=A, node font=\sffamily\bfseries},
 every path/.style = {-{Triangle[angle=45:2pt 3]},thick},
                        ]
%%%%
% groups names
\node[unbox] (Vor)      {Vorbereitung};
\node[unbox] (Klass)    {Klassifikation};
\node[unbox] (Inb)      {Inbetriebnahme};
% first group content
\node[box, suspend join,
      below=of Vor] (Roh)  {Rohdaten};
\node[box] (extraktion) {Merkmalsextraktion};
\node[box] (selektion)  {Merkmalsselektion};
% second group content
\node[box, suspend join,
      below = of Klass] (PaTu) {Parameter Tuning};
\node[box] (ProMo)      {Prototypmodell};
\node[box] (Off)        {Offline--Evaluation};
% third group content
\node[box, suspend join,
      below = of Inb] (Ein) {  Einsatzmodell};
\node[box] (On)         {Online--Evaluation};
% fit
\node (f1) [FIT=(Vor)   (selektion)];
\node (f2) [FIT=(Klass) (Off)];
\node (f3) [FIT=(Inb)   (Inb |- Off.south)];
%
\draw   (extraktion -| f1.east) -- (ProMo -| f2.west);
\draw   (ProMo -| f2.east) -- (On -| f3.west);
\draw   (Off -| f2.west) -- (selektion -| f1.east);
    \end{tikzpicture}
\end{document}

enter image description here

  • Sorry to say that, but you copied the good things from my answer and made some things worse. In my answer one does not have to look which box is the tallest as you do when you say \node (f3) [FIT=(Inb) (Inb |- Off.south)];, it is all automatic, which is also why it does not make sense to use a style for this since the fit style only gets used once in the loop. – user121799 May 4 at 16:07
  • @marmot, if you say so ... but i copied from your answer only text in nodes, as i said in my answer. of course, your answer is far, far, far, ..., far better. but anyway, i will not delete mine for this reason. – Zarko May 4 at 16:12
  • Well, all the commands of the type \draw (extraktion -| f1.east) -- (ProMo -| f2.west); are also in my code (of course with different node names). – user121799 May 4 at 17:08
2

With a TikZ matrix:

\documentclass{article}
\usepackage{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,matrix,fit}
\tikzset{
    base/.style={
        minimum width=4cm,
        text height=2.5ex,
        text depth=1ex
        },
    punktchain/.style={
        draw, thick,
        base
        },
    }

\begin{document}
\begin{figure}[htb]
    \centering
    \begin{tikzpicture}[>=Latex]
        \matrix[
            matrix of nodes,
            nodes in empty cells,
            row sep=4ex,
            column sep=3.5em,
            row 1/.style={nodes={font=\bfseries}},
            row 2/.style={nodes={punktchain}},
            row 3/.style={nodes={punktchain}},
            row 4 column 1/.style={nodes={punktchain}},
            row 4 column 2/.style={nodes={punktchain}},
            row 4 column 3/.style={nodes={base}},
            ] (mymatr) {
            Vorbereitung & Klassifikation & Inbetriebnahme\\  
            Rohdaten & Parameter Tuning & Einsatzmodell\\
            Merkmalsextraktion & Prototypmodell & Online--Evaluation\\
            Merkmalsselektion & Offline--Evaluation &\\
            };
            \foreach \ind in {1,...,3}
            {\node[fit=(mymatr-1-\ind)(mymatr-4-\ind), draw, thick, inner sep=8pt](F\ind){};}
            \foreach \ind in {1,2,3}
            {\draw[->] (mymatr-2-\ind) -- (mymatr-3-\ind);}
            \foreach \ind in {1,2}
            {\draw[->] (mymatr-3-\ind) -- (mymatr-4-\ind);}
            \draw[->] (mymatr-3-1 -| F1.east) -- (mymatr-3-2 -| F2.west);
            \draw[->] (mymatr-3-2 -| F2.east) -- (mymatr-3-3 -| F3.west);
            \draw[->] (mymatr-4-2 -| F2.west) -- (mymatr-4-1 -| F1.east);
    \end{tikzpicture}
\end{figure}
\end{document}

enter image description here

  • This answer cannot be left at zero :-) – Sebastiano May 4 at 20:38
  • @Sebastiano Thank you – CarLaTeX May 4 at 22:02
  • I always give Caesar what is Caesar's. – Sebastiano May 4 at 22:03

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.