4

I have the flow chart below, and would like an arrow like the one added in green with a condition written on top of it (but in the same gray color as the other arrows of course)

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning,shadows}
\usetikzlibrary{shapes,arrows}
\begin{document}
\pagestyle{empty}

% Define block styles
\tikzstyle{big} = [rectangle, draw, fill=blue!20, 
text width=30em, text centered, rounded corners, minimum height=4em]
\tikzstyle{small} = [rectangle, draw, fill=blue!20, 
text width=14em, text centered, rounded corners, minimum height=4em]

\begin{figure}[!ht]
  \centering
  \quad
  \begin{tikzpicture}[align = center, node distance = 2.5cm, auto, >=latex, %Make the arrow tips latex
    myline/.style={ultra thick,black!50},
    shorter/.style={shorten <=1mm,shorten >=0.5mm}]

    % nodes
    \node [big] (A) {Blabla};
     \node[big, below of = A] (B) {Blabla};
     \node[big, below of = B] (C) {Blabla};
     \node[small, below=2.5cm of C.west, anchor=west] (Da) {Blabla};
     \node[small, below=3.7cm of C.east, anchor=east] (Ea) {Blabla};
     \node[small, below of = Da] (Db) {Blabla};
     \node[big, below = 2.5cm of Db.west, anchor=west] (F) {Blabla};
     \node[big, below of = F] (G) {Blabla};
     \node[big, below of = G] (H) {Blabla};
     \node[big, below of = H] (I) {Blabla};

     % Edges
     \draw[myline,->, shorter] (A) -- (B);
     \draw[myline,->, shorter] (B) -- (C);
     \draw[myline,->, shorter] ([xshift=2.6cm]C.south west) -- (Da);
     \draw[myline,->, shorter] (Da) -- (Db);
     \draw[myline,->, shorter] ([xshift=8.2cm]C.south west) -- (Ea);
     \draw[myline,->, shorter] ([xshift=2.6cm]Db.south west) ++(0,0) -- ++(0,-0.5) -| (F);
     \draw[myline,->, shorter] ([xshift=2.6cm]Ea.south west) ++(0,0) -- ++(0,-1.8) -| (F);
     \draw[myline,->, shorter] (F) -- (G);
     \draw[myline,->, shorter] (G) -- (H);
     \draw[myline,->, shorter] (H) -- (I);

  \end{tikzpicture}
\end{figure}

\end{document}

<code>enter image description here</code>

5

The arrow you want could be something like:

\draw[myline,->, shorter] (I) --++(-90:15mm)-|([xshift=10mm]G.east) node[pos=.25,above]{some text}--(G);

which means, draw from (I.center) (but starting at corresponding border) to a point which is 15mm below (direction -90 degrees) and move the pen to this point (++). Then draw a corner (-|) from this point to another which is ([xshift=10mm]G.east) and finally ends to (G.center) (respecting corresponding border).

The text is centered over horizontal line with pos=0.25, because pos=0.5 always correspond to corners when using |- or -|.

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning,shadows}
\usetikzlibrary{shapes,arrows}
\begin{document}
%\pagestyle{empty}

% Define block styles
\tikzstyle{big} = [rectangle, draw, fill=blue!20, 
text width=30em, text centered, rounded corners, minimum height=4em]
\tikzstyle{small} = [rectangle, draw, fill=blue!20, 
text width=14em, text centered, rounded corners, minimum height=4em]

%\begin{figure}[!ht]
%  \centering
%  \quad
  \begin{tikzpicture}[align = center, node distance = 2.5cm, auto, >=latex, %Make the arrow tips latex
    myline/.style={ultra thick,black!50},
    shorter/.style={shorten <=1mm,shorten >=0.5mm}]

    % nodes
    \node [big] (A) {Blabla};
     \node[big, below of = A] (B) {Blabla};
     \node[big, below of = B] (C) {Blabla};
     \node[small, below=2.5cm of C.west, anchor=west] (Da) {Blabla};
     \node[small, below=3.7cm of C.east, anchor=east] (Ea) {Blabla};
     \node[small, below of = Da] (Db) {Blabla};
     \node[big, below = 2.5cm of Db.west, anchor=west] (F) {Blabla};
     \node[big, below of = F] (G) {Blabla};
     \node[big, below of = G] (H) {Blabla};
     \node[big, below of = H] (I) {Blabla};

     % Edges
     \draw[myline,->, shorter] (A) -- (B);
     \draw[myline,->, shorter] (B) -- (C);
     \draw[myline,->, shorter] ([xshift=2.6cm]C.south west) -- (Da);
     \draw[myline,->, shorter] (Da) -- (Db);
     \draw[myline,->, shorter] ([xshift=8.2cm]C.south west) -- (Ea);
     \draw[myline,->, shorter] ([xshift=2.6cm]Db.south west) ++(0,0) -- ++(0,-0.5) -| (F);
     \draw[myline,->, shorter] ([xshift=2.6cm]Ea.south west) ++(0,0) -- ++(0,-1.8) -| (F);
     \draw[myline,->, shorter] (F) -- (G);
     \draw[myline,->, shorter] (G) -- (H);
     \draw[myline,->, shorter] (H) -- (I);
     \draw[myline,->, shorter] (I) --++(-90:15mm)-|([xshift=10mm]G.east) node[pos=.25,above]{some text}--(G);

  \end{tikzpicture}
%\end{figure}

\end{document}

enter image description here

3

use node[pos=xx]{}

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}

\begin{tikzpicture}

\node[draw] (node1) at (0,0){node 1};


\node[draw] (node2) at (0,-5){node 2};

\draw[-latex] (node2.south) |-
    node[pos=0.75,above]{text 1}
    ($(node2.south east)+(2,-1)$) |- 
    node[pos=0.25,right]{text 2}
     node[pos=0.75,below]{text 3}
     (node1.east)
    ;
\end{tikzpicture}

\end{document}

enter image description here

2

Solution for loop is similar to solutions given in answers of rpapa and Ignasi, but the whole diagram is drawn on more sophisticated way:

  • common nodes features is collected in style base
  • bigger nodes are on chain and connected by macro join
  • smaller nodes are positioned by help of library positioning
  • added is new command suppress join, which discontinue join's connection between the first and the second part of big nodes

Complete MWE:

\documentclass[tikz, border=5mm]{standalone}
\usetikzlibrary{arrows.meta, calc, chains, positioning}

\makeatletter
\tikzset{suppress join/.code={\def\tikz@after@path{}}}
\makeatother

\begin{document}
    \begin{tikzpicture}[
    node distance = 11mm and 0mm,
      start chain = going below,
every path/.style = {draw=black!50, ultra thick,
                     shorten <=1mm,shorten >=0.5mm,
                     -Latex}, 
      base/.style = {rectangle, draw, fill=blue!20, rounded corners, 
                     minimum height=4em, align=center},
       big/.style = {base, text width=30em, on chain, join}, 
     small/.style = {base, text width=14em},
                        ]
% nodes
\node[big] (A) {Blabla};
\node[big] (B) {Blabla};
\node[big] (C) {Blabla};
%
\node[small, below right=of C.south west] (Da) {Blabla};
\node[small, below=of Da]                 (Db) {Blabla};
\node[small, right=2em of $(Da.east)!0.5!(Db.east)$]   (E) {Blabla};
%
\node[big, suppress join,
                below = of Db.south -| C]    (F)  {Blabla Blabla};
\node[big] (G) {Blabla};
\node[big] (H) {Blabla};
\node[big] (I) {Blabla};
% Edges
\draw (C.south -| Da) edge (Da) (Da) edge (Db)
      (C.south -| E)  edge (E)  (F)   --  (G);
%
\draw (Db) |- ([yshift=7mm] F.north) coordinate (Fa) -- (F); 
\draw (E)  |- (Fa) -- (F);
%
\draw[red] (I.south) -- ++(0,-11mm) 
                -| ($(I.east)+(11mm,0)$) node[pos=0.25,above] {add text here}
                |- (F);
    \end{tikzpicture}
\end{document}

enter image description here

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.