# How to get a wavy arrow for an edge?

What option do I need to get a wavy arrow between two points:

\documentclass{article}
\usepackage{tikz}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{mathrsfs}
\usepackage{textcomp}
\usetikzlibrary{arrows}
\usetikzlibrary{decorations.pathmorphing}
\pagenumbering{gobble}
\begin{document}
\centering

\vfill

\begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,fill=#1!0,draw,font=\sffamily\Large\bfseries}]

\node[main node=black] (1) {a};
\node[main node=black](2)[right of=1]{b};

\path[every node/.style={font=\sffamily\small}]
(1) edge[<<<WAVY ARROW OPTION>>>, very thick, color=blue] node [] {} (2)
;

\end{tikzpicture}
\end{document}


I assume the fix is an easy option where I've put <<<WAVY ARROW OPTION>>>.

• Welcome to TeX.SE! See Tikz & PGF manuel, page 581. There is on the top of page example \begin{tikzpicture}[decoration=snake] \draw [help lines] grid (3,2); \draw [decorate,fill=yellow!80!black] (0,0) -- (3,1) arc (0:180:1.5 and 1) -- cycle; \end{tikzpicture}. For it you need to load library decorations.pathmorphing. Jan 8 '17 at 18:48
• So, I just put that right where (options) is? Jan 8 '17 at 18:52
• ??? (1) edge[decoration=snake, very thick, color=black]node[]{}(2) ??? Jan 8 '17 at 18:56
• Solution in your comment is not correct. See example in my comment. The best would be, that you read mentioned manual. Given example can serve as starting point. For more help you need provide a minimal working example: complete small document starting with documentclass{...} and end with \end{document}. Than someone her (including me) can help you in solving of your problem. Jan 8 '17 at 19:04
• @Zarko, I've made an edit to my post. Jan 8 '17 at 19:08

\documentclass[tikz, border=3mm]{standalone}
\usetikzlibrary{arrows, decorations.pathmorphing}

\begin{document}
\centering
\begin{tikzpicture}[
->,    > = stealth',
shorten > = 1pt,auto,
node distance = 3cm,
decoration = {snake,   % <-- added
pre length=3pt,post length=7pt,% <-- for better looking of arrow,
},
main node/.style = {circle,draw,fill=#1,
font=\sffamily\Large\bfseries},
]
\node[main node=black]  (1)     {a};
\node[main node=black]  (2) [right of=1]{b};

\path[draw=blue, very thick, decorate] (1) -- node[above] {?} (2);
\draw[red] (1) -- node[below] {straight line} (2);
\end{tikzpicture}
\end{document}


In your MWE I consider only for image necessary packages, i.e. only TikZ libraries. For better looking of arrow I add "complications" which make begin and end of arrow straight.

Edit: decoration is activated only on path with option decorate. Consequently red line (note: \drawis shorthand for\path[draw]), which hasn't optiondecorate.

• So does this make all my arrows wavy? Because I only need one. Jan 8 '17 at 19:23
• no, only this one, which for option has decorate. See edit of my answer (will appear soon). Jan 8 '17 at 19:24
• Now, how do you choose whether or not the text is on the left or right (above or below) of the arrow? Jan 8 '17 at 20:05
• you really need to read TikZ manual. In Part I are tutorials, where is explained this :). In your case for text on the left from arrows start: \draw[...] (...) node[left] {text} -- (...);, for node right of the arrow's end:\draw[...] (...) -- (...) node[right] {text} ;, for above right of arrow start: \draw[...] (...) node[above right] {text} -- (...); etc. for above and below of arrow's middle, see MWE in answer. for placing text on arrows you can use quotes` library too. Jan 8 '17 at 20:27