4

Assumed we have this MWE from user Caramdir:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,calc,decorations.markings,decorations.pathmorphing,arrows.meta}

\begin{document}
\begin{tikzpicture}
    \draw [domain=0:25.1327,variable=\t,smooth,samples=75, -Latex]
        plot ({\t r}: {0.002*\t*\t});
\end{tikzpicture}
\end{document}

Screenshot of the result


I want to reverse the arrow head position, so that the arrow tip is located at the inner end of the spiral and directs to the center.

How to do so?

Dave
  • 3,758
  • instead -Latex use Latex-? however, the result be ugly .... – Zarko Mar 30 '19 at 23:29
  • You just place the arrow in the other end in the options: Latex- -and then you will need to have a look at: https://tex.stackexchange.com/questions/176779/how-can-i-improve-the-look-of-an-arrowhead-at-the-end-of-a-small-radius-arc/176781#176781 – hpekristiansen Mar 30 '19 at 23:29

2 Answers2

5

To have arrow's head on opposition side of the spiral curve, you only need to change -Latex to Latex-. However result is quite unexpected (read unusable) ...

It might be more acceptable solution to move the arrow head close to the end of the spiral. For this you can exploit the package decorations.markings:

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{arrows.meta, bending, decorations.markings}

\begin{document}
    \begin{tikzpicture}[
decoration = {markings,mark=at position .84 with
             {\arrowreversed[black]{Latex[length=1.5mm]}}}
                        ]
\draw[postaction={decorate}]
    plot[domain=0:25,variable=\t,smooth,samples=101,
           {Latex[length=1mm]}-]
        ({\t r}: {0.002*\t*\t});
\end{tikzpicture}
\end{document}

enter image description here

Zarko
  • 296,517
  • It would be great if you could mention that you used the position 0.84 because it does not work for much smaller values of the position, e.g. ... at position .14 with ... throws a dimension too large error. In fact, any position below .34 has that problem. And then you may want to add that your proposal is, let's say, strongly inspired by https://tex.stackexchange.com/a/39282/121799. –  Mar 31 '19 at 04:48
  • Dear @marmot, my solution is based on example from page 639, TikZ and PGF manual, v 3.1) . I was not aware for mentioned answer, thank you for pointed me to it. Value 0.84 for arrow head position I determined experimentally, according to my taste (that arrow head is approximately below origin of spiral). Your observation about positioning of harrow head is very good! – Zarko Mar 31 '19 at 06:27
3

First of all, I would like to argue that bent arrows look better, also in the original plot. But since the curve becomes singular at 0, this does not immediately work because of dimension too large errors. However, it does once we approximate the inner-most stretch by an arc.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,bending}

\begin{document}
\begin{tikzpicture}[scale=2]
    \pgfmathsetmacro{\myt}{pi}   
    \draw[{Latex[bend,length=2pt]}-] 
    (0: {0.002*\myt*\myt})
    arc({0}:{180}:{0.002*\myt*\myt});
    \draw  plot[domain=pi:25.1327,variable=\t,samples=75,smooth]
         ({\t r}: {0.002*\t*\t});
\end{tikzpicture}
\end{document}

enter image description here

And here is the original pic with a bent arrow.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,bending}

\begin{document}
\begin{tikzpicture}
    \draw [domain=0:25.1327,variable=\t,smooth,samples=75, -{Latex[bend]}]
        plot ({\t r}: {0.002*\t*\t});
\end{tikzpicture}
\end{document}

enter image description here

Note that one should always load bending when one attaches arrows to curved paths, regardless of whether or not one bends the arrows, since otherwise the paths get distorted. Bending cures the distortion even when not explicitly used.