我想绘制 rnn 的循环层。因此,我使用以下代码,但无法在循环箭头上放置标签 (\nu)。图片显示了我想要的输出,只是缺少一个标签。
您知道如何实现这个目标吗?
\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}
答案1
只需添加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}
您也可以与 合作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}