2

I have a TikZ figure which I would like to modify. I am new to TikZ, and I would appreciate if someone could give a hand. My figure is a flowchart-like diagram with arrows and figures:

\tikzstyle{int}=[draw, fill=blue!20, minimum size=2em]
\tikzstyle{init} = [pin edge={to-,black}]

\begin{tikzpicture}[node distance=4.5cm,auto,>=latex']
    \node [int, pin={[init]below:Input2}] (a) {Box1};
    \node (b) [left of=a,node distance=4.5cm, coordinate] {a};
    \node [int] (c) [right of=a] {Box2};
    \node [coordinate] (end) [right of=c, node distance=3.5cm]{};
    \path[->] (b) edge node {Arrow1} (a);
    \path[->] (a) edge node {Arrow2} (c);
    \draw[->] (c) edge node {Arrow3}  (end) ;
\end{tikzpicture}

I would like to get something like these:  these. (I have two different diagrams, it does not represent a single image.) Where do I start?

1 Answer 1

2

Try this code:

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\tikzstyle{int}=[draw, fill=blue!20, minimum size=2em]
\tikzstyle{init} = [pin edge={to-,black}]
\begin{document}
    \begin{tikzpicture}[node distance=4.5cm]
        \node [int, pin={[init]below:Input1}] (a) {Box1};
        \node (b) [left of=a, coordinate] {a};
        \node [int, pin={[init]below:Input2}] (c) [right of=a] {Box2};
        \node [coordinate] (end) [right of=c]{};
        \path[->] (b) edge node[midway,above] {Arrow1} (a);
        \path[->] (a) edge node[midway,above] {Arrow2} (c);
        \draw[->] (c) edge node[midway,above] {Arrow3}  (end) ;
    \end{tikzpicture}
    
\end{document}

that produce this output:

enter image description here

EDIT1:

New code:

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\tikzstyle{int}=[draw, fill=blue!20, minimum size=2em]
\tikzstyle{init} = [pin edge={to-,black}]
\begin{document}
    \begin{tikzpicture}[node distance=3.5cm]
        \node [int, pin={[init]}] (a) {Input1};
        \node (b) [left of=a, coordinate] {a};
        \node [int, pin={[init]}] (c) [right of=a] {Input2};
        \node [coordinate] (end) [right of=c]{};
        \path[->] (b) edge node[midway,above] {Arrow1} (a);
        \path[->] (a) edge node[midway,above] {Arrow2} (c);
        \draw[->] (c) edge node[midway,above] {Arrow3}  (end) ;
    \end{tikzpicture}
    
\end{document}

New output:

enter image description here

EDIT2:

If you dont want arrows above the Input boxes try this code:

\documentclass[border=3mm]{standalone}
\usepackage{tikz}
\tikzstyle{int}=[draw, fill=blue!20, minimum size=2em]
\tikzstyle{init} = [pin edge={to-,black}]
\begin{document}
    \begin{tikzpicture}[node distance=3.5cm]
    %   \node [int, pin={[init]}] (a) {Input1};
        \node [int] (a) {Input1};
        \node (b) [left of=a, coordinate] {a};
    %   \node [int, pin={[init]}] (c) [right of=a] {Input2};
        \node [int] (c) [right of=a] {Input2};
        \node [coordinate] (end) [right of=c]{};
        \path[->] (b) edge node[midway,above] {Arrow1} (a);
        \path[->] (a) edge node[midway,above] {Arrow2} (c);
        \draw[->] (c) edge node[midway,above] {Arrow3}  (end) ;
    \end{tikzpicture}
    
\end{document}

that produce the output:

enter image description here

3
  • Thank you for your help. Is there a way I can put Input1 inside the blue box, so that in the box, there is Input1, the arrow between input1 and box1, and the text Box1, Feb 13, 2022 at 11:44
  • @dynamicdivergent I dont understand well: you want only Input1 inside the blue box and outside below nothing? Same thing for Input2? Feb 13, 2022 at 11:48
  • I want Input1 to be in inside the box, and inside the box, I also want an arrowed text inside the box. Then, I want a text line over the box. You can check the image I posted on the original question. (Orange box: Text1, Box1, Input2) Feb 13, 2022 at 13:09

You must log in to answer this question.

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