1

I am quite puzzled when drawing the connection of nodes.

\usepackage{xcolor}
\definecolor{darkblue}{HTML}{1F4E79}
\definecolor{salmon}{HTML}{FF9C6B}
\tikzstyle{cell} = [rectangle, minimum width=1cm, minimum height=0.5cm,text centered, draw=black, fill=salmon]
\tikzstyle{state} = [rectangle, minimum width=1cm, minimum height=0.5cm,text centered, draw=black, fill=darkblue]
\tikzstyle{arrow} = [thick,->,>=stealth]

\begin{tikzpicture}[thick,scale=0.8, every node/.style={scale=0.8},node distance=1.5cm]
    \node (0) [state] {\textcolor{white}{feature extraction}};
    \node (1) [cell, below of=0] {invertBotConE2\_f48\_k1\_b4\_noskip};
    \node (2) [cell, below of=1] {invertBotConE2\_f16\_k3\_b4\_noskip};
    \draw [arrow] (0) -- (1);
    \draw [arrow] (1) -- (2);
    \draw  (0.east)  [arrow]  edge [out=0, in=0, out looseness=4, in looseness=4]  (2.north);
\end{tikzpicture}

0,2 are my nodes. When east is specified, it creates an arrow on node 0. If removed, it disappears. What if I would like to put 0.south as the start of the edge?

double-headed connection

0
1

Use to instead of edge.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{xcolor}
\definecolor{darkblue}{HTML}{1F4E79}
\definecolor{salmon}{HTML}{FF9C6B}
\tikzset{cell/.style={rectangle, minimum width=1cm, minimum height=0.5cm,text
centered, draw=black, fill=salmon},
state/.style={rectangle, minimum width=1cm, minimum height=0.5cm,text
centered, draw=black, fill=darkblue},
arrow/.style={thick,->,>=stealth}}
\begin{document}
\begin{tikzpicture}[thick,scale=0.8, every node/.style={scale=0.8},node distance=1.5cm]
    \node (0) [state] {\textcolor{white}{feature extraction}};
    \node (1) [cell, below of=0] {invertBotConE2\_f48\_k1\_b4\_noskip};
    \node (2) [cell, below of=1] {invertBotConE2\_f16\_k3\_b4\_noskip};
    \draw [arrow] (0) -- (1);
    \draw [arrow] (1) -- (2);
    \draw  (0.east)  [arrow]  to[out=0, in=0, out looseness=4, in looseness=4]  (2.north);
\end{tikzpicture}
\end{document}

Or use the appropriate syntax with edge.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{xcolor}
\definecolor{darkblue}{HTML}{1F4E79}
\definecolor{salmon}{HTML}{FF9C6B}
\tikzset{cell/.style={rectangle, minimum width=1cm, minimum height=0.5cm,text
centered, draw=black, fill=salmon},
state/.style={rectangle, minimum width=1cm, minimum height=0.5cm,text
centered, draw=black, fill=darkblue},
arrow/.style={thick,->,>=stealth}}
\begin{document}
\begin{tikzpicture}[thick,scale=0.8, every node/.style={scale=0.8},node distance=1.5cm]
    \node (0) [state] {\textcolor{white}{feature extraction}};
    \node (1) [cell, below of=0] {invertBotConE2\_f48\_k1\_b4\_noskip};
    \node (2) [cell, below of=1] {invertBotConE2\_f16\_k3\_b4\_noskip};
    \draw [arrow] (0) -- (1);
    \draw [arrow] (1) -- (2);
    \draw  (0.east)    edge[arrow,out=0, in=0, out looseness=4, in looseness=4]  (2.north);
\end{tikzpicture}
\end{document}

enter image description here

(Attempt of an)explanation: edge inserts a new path. So you had two paths, and two arrows.

2
  • to works! Thanks a lot. – MeadowMuffins Jan 20 '19 at 3:02
  • @MeadowMuffins edge also works if you put arrow inside its arguments. (BTW, please consider using \tikzset instead of \tikzstyle.) – user121799 Jan 20 '19 at 3:05

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.