So erstellen Sie mit Tikz eine Infografikbox mit Pfeil

So erstellen Sie mit Tikz eine Infografikbox mit Pfeil

Ich möchte eine Box mit einem Pfeil zeichnen, der definiert ist alsInfographic Box with Arrow alsdieser Link. Ich möchte die folgende Abbildung aktualisieren, um ein Diagramm von oben nach unten zu erstellen.

\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{shapes.geometric, arrows}

\begin{document}
\begin{tikzpicture}[font=\small, node distance=2cm]
\tikzstyle{block} = [rectangle, draw, text width=12cm, text centered, rounded corners, minimum height=4em]
\tikzstyle{line} = [draw, -latex']

\node [block] (step1) {Alpha process};
\node [block, below of=step1] (step2) {Beta analysis};
\node [block, below of=step2] (step3) {Gamma results};

\path [line] (step1) -- (step2);
\path [line] (step2) -- (step3);
\end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

Gibt es eine Möglichkeit, meine Boxen zu aktualisieren und ihnen das Aussehen wie in der Abbildung unten zu verleihen?

Bildbeschreibung hier eingeben

Antwort1

Dershapes.arrowsDie mit Ti geliefertekZ hat einearrow boxFormwas Sie versuchen könnten:

\documentclass[tikz, border=10pt]{standalone}
\usetikzlibrary{shapes.arrows}

\begin{document}
\begin{tikzpicture}
\tikzset{
    font=\small, 
    node distance=2cm,
    block/.style={
        arrow box, 
        draw, 
        text width=12cm, 
        text centered, 
        minimum height=4em,
        arrow box arrows={south:0.5cm}
    },
    last block/.style={
        block,
        arrow box arrows={south:0cm}
    }
}

\node[block] (step1) {Alpha process};
\node[block, below of=step1] (step2) {Beta analysis};
\node[last block, below of=step2] (step3) {Gamma results};

\end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

Beachten Sie, dass Sie \tikzsetanstelle von verwenden sollten \tikzstyle.


Alternativ können Sie die Grenzen der Knoten per Hand zeichnen oder, um Wiederholungen in Ihrem Code zu vermeiden, Folgendes erstellen \pic:

\documentclass[tikz, border=10pt]{standalone}
\usetikzlibrary{shapes.arrows}

\begin{document}
\begin{tikzpicture}
\tikzset{
    font=\small, 
    node distance=2cm,
    pics/box with arrow/.style={
        code={
            \node[pic actions, text centered] (-node) {#1};
            \draw[rounded corners] 
                ([xshift=-0.25em]-node.south) -| (-node.north west) -| 
                (-node.south east) -- ([xshift=0.25em]-node.south);
            \draw ([xshift=-0.25em]-node.south) |- ++(-0.25em,-0.5em) --
                ++(0.5em,-0.5em) -- ++(0.5em,0.5em) -| ++(-0.25em,0.5em);
        }
    },
    pics/box without arrow/.style={
        code={
            \node[pic actions, text centered] (-node) {#1};
            \draw[rounded corners] 
                (-node.south east) rectangle (-node.north west);
        }
    }
}

\pic[text width=12cm, minimum height=4em] 
    (step1) {box with arrow={Alpha process}};

\pic[below of=step1-node, text width=12cm, minimum height=4em] 
    (step2) {box with arrow={Beta analysis}};

\pic[below of=step2-node, text width=12cm, minimum height=4em] 
    (step3) {box without arrow={Gamma results}};

\end{tikzpicture}
\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen