# drawing crazy arrows in tikz

I'm trying to show that the dependence between two nodes in a tikz picture is not smooth. I thought I would add a crazy arrow like the following:

Of course my drawing is not the best, but you get the idea. I would like the arrow to have varying amplitudes and frequencies to show that the path from node A to node B is quite rough. Is there a way to do this using tikz? (or a better crazy arrow, more symmetric and periodic?)

• – CroCo Oct 14 '15 at 17:55
• A squiggle arrow is not that crazy, is it? – aaragon Oct 14 '15 at 17:56
• Then define crazy. – CroCo Oct 14 '15 at 17:57
• I did, look at the picture... – aaragon Oct 14 '15 at 17:57
• Of course my drawing is not the best? Well, this doesn't seem a definition. – CroCo Oct 14 '15 at 17:58

This is another option, using the sin and cos operations:

\documentclass{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\draw[ultra thick,cyan,->,>=latex]
(-2,0) --
(0,0) sin (0.5,3) cos (1,0) sin (1.5,-3) cos (2,0)
sin (2.5,2) cos (3,0) sin (3.5,-2) cos (4,0)
sin (4.5,4) cos (5,0) sin (5.5,-4) cos (6,0)
sin (6.25,1.5) cos (6.5,0) sin (6.75,-1.5) cos (7,0)
-- ++(1.5,0);
\end{tikzpicture}

\end{document}


A variation on the same theme, but using plot:

\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}

\begin{document}

\begin{tikzpicture}
\begin{scope}[cyan,ultra thick]
\draw
(-1,0) -- (0,0);
\draw[domain=0:2*pi,x=10pt]
(0,0) plot (\x,{sin(\x r)}) coordinate (end1);
\draw[shift={(end1)},domain=0:2*pi,x=10pt,smooth]
(end1) plot (\x,{2*sin(\x r)}) coordinate (end2);
\draw[shift={(end2)},domain=0:2*pi,x=10pt,smooth]
(end2) plot (\x,{5*sin(\x r)}) coordinate (end3);
\draw[shift={(end3)},domain=0:2*pi,x=3pt,smooth]
(end3) plot (\x,{0.5*sin(2*\x r)}) coordinate (end4);
\draw[->,>=latex] (end4) -- ++(1,0);
\end{scope}
\end{tikzpicture}

\end{document}


• I guess I can add as many frequencies as I would like to. Thanks! – aaragon Oct 14 '15 at 18:25
• @aaragon You're welcome! I added another option to my answer that could be of interest for you. – Gonzalo Medina Oct 14 '15 at 18:49

TikZ has a path decoration called random steps. You should be able to get sufficiently crazy paths by adjusting the segment length and amplitude values. For something periodic (and much less crazy), you can use the snake decoration, which has similar adjustable parameters. See section 24 in the TikZ documentation.

\documentclass[border=2pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}

\begin{document}
\begin{tikzpicture}
\draw[-stealth,decorate,decoration={random steps,segment length=3pt,amplitude=4pt,pre length=2pt,post length=3pt}] (0,0) -- (2,0);
\draw[-stealth,decorate,decoration={snake,amplitude=3pt,pre length=2pt,post length=3pt}] (0,-0.5) -- ++(2,0);
\end{tikzpicture}
\end{document}


• Great! This is sort of what I'm looking for and I will definitely use it if I don't get the type of arrow I would like to have. Any ideas on how I can get something that looks more "periodic"? – aaragon Oct 14 '15 at 18:18
• @aaragon Please see my edited answer. – erik Oct 14 '15 at 18:25
• Your second option, though periodic, it doesn't look that crazy. Gonzalo's option is what I am looking for. But I appreciate your effort a lot erik, I wish I could give two correct answers here. – aaragon Oct 14 '15 at 18:30