1

I want to draw a recurrent layer of a rnn. Therefore I am using the following code but can't manage to put a label (\nu) on the recurrent arrow. The picture show my desired output, its simply a label missing.

Do you have any idea how to achieve this?

\documentclass[tikz,border=2mm]{standalone}

\begin{document}

\begin{tikzpicture}
[   cnode/.style={draw=black,fill=#1,minimum width=3mm,circle},
]

    % add fourth input (n)
    \node[cnode=blue,label=180:$x$] (x) at (0,0) {};
    \node[cnode=gray,label=110:$x^{(1)}$] (h) at (0,2) {};
    \draw [->](x) -- node[right,pos=0.45] {$\omega$} (h);
    \draw [->](h) to [out=30,in=330,looseness=15] {$\nu$} (h);

\end{tikzpicture}

\end{document}

enter image description here

1

Just add node[right].

\documentclass[tikz,border=2mm]{standalone}

\begin{document}

\begin{tikzpicture}
[   cnode/.style={draw=black,fill=#1,minimum width=3mm,circle},
]

    % add fourth input (n)
    \node[cnode=blue,label=180:$x$] (x) at (0,0) {};
    \node[cnode=gray,label=110:$x^{(1)}$] (h) at (0,2) {};
    \draw [->](x) -- node[right,pos=0.45] {$\omega$} (h);
    \draw [->](h) to [out=30,in=330,looseness=15] node[right]{$\nu$} (h);

\end{tikzpicture}

\end{document}

enter image description here

You could also work with quotes.

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{quotes}
\begin{document}

\begin{tikzpicture}
[   cnode/.style={draw=black,fill=#1,minimum width=3mm,circle},
]

    % add fourth input (n)
    \node[cnode=blue,label=180:$x$] (x) at (0,0) {};
    \node[cnode=gray,label=110:$x^{(1)}$] (h) at (0,2) {};
    \draw [->](x) -- node[right,pos=0.45] {$\omega$} (h);
    \draw [->](h) to [out=30,in=330,looseness=15,"$\nu$"]  (h);

\end{tikzpicture}

\end{document}
  • oh well that was easy, thank you :) I always kept trying to put the right argument in [out=30,in=330,looseness=15]... – Quastiat Sep 3 at 14:38
  • @Quastiat You can do that if you load quotes. I added an example of that sort, too. – Schrödinger's cat Sep 3 at 14:39

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.