Drawing a Biologist's Looping Arrow with TikZ
These arrows label something on a diagram and they make a loop to avoid being mistaken for e.g. a vector. TikZ offers the coil decoration which is used here.
1 Using the Coil Decoration
Using the coil decoration can be somewhat tricky. This recipe illustrates how to use it to draw a biologist's arrow:
- You'll need to
\usetikzlibrary{decorations.pathmorphing}first. A bare-bones coil could be made with something like:
This would yield a picture similar to this one:\draw[->,decorate,decoration={coil}] (0,0) -- (45:2);
- For the time being, we have a zigzagging path: that's because we look at the coil from its side; in order to see a loop, you need to shift your point of view left or right with the
aspectparameter (which defaults to 0.5): Note that the more you shift, the more the loop will look like perfect circles until, at some point, you look down the coil.
- Let's try to have a bigger loop: you can perform this by tuning the
amplitudeparameter, which is the radius of the coil (in points). The following is drawn withamplitude=10:
The next problem we want to address is the little stretch at the end of the coil, right before the arrow which has the arrow point to a possibly irrelevant heading; we'd rather have the arrow be drawn somewhere in the loop. I haven't yet come across a better idea than actually reversing the path, i.e. drawing the path backwards and having the arrow point backwards. On top of that, you'll need to swap the aspect as well (
aspect=-1.1), otherwise, you'll loop in the wrong direction; and that'll have you swap the amplitude as well, otherwise the arrow will sort of point inside the loop instead of outside:\draw[<-,decorate,decoration={coil,aspect=-1.1, amplitude=-10}] (0,0) ++(45:2) -- +(45:-2);
- Now, you'll need to have the path loop only once: this is done by setting the
segment lengthparameter accordingly (in points). Here, I've setsegment length=14, which is the shortest possible length such that there's only one loop (segment length=13would have been short enough a segment to fit two loops on the 2 cm path we're dealing with): The problem here is that there's a straight stretch of line at the beginning (i.e. end, but you see what where I'm going) of the path: by setting
segment length=23, you'll have the path draw a segment as long as possible such that such a segment can still fit in the 2 cm path we have; that way, you'll shorten the straight stretch a good deal, possibly even visually completely. On top of that, this operation will have the arrow lift its nose a little, which isn't a bad thing:
Removing the straight stretch of line completely isn't always possible: the best way to do so is to clip the path.
