# [Tex/LaTex] PGFPlots Parametric Plot, Arrow Spacing by Constant Time

arrowspgfplotstikz-pgf

For a parametric plot of a particle's position (x(t),y(t)), is it possible to usepgfplots to draw arrows equally spaced in time to indicate the direction of travel?

For example, with (x(t),y(t)) = (t,t^2), I know how to produce arrows equally spaced in length:

\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{decorations.markings}
\pgfplotsset{compat=1.8}

\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines = middle,smooth,xlabel = $x$, ylabel =$y$, minor tick num =1, grid=both, unit vector ratio*=1 1,enlargelimits = true]
markings,
mark=between positions 0.2 and 0.99 step 2em with {\arrow [scale=1.5]{stealth}}
}, postaction=decorate] ({t^2}, {t^4});
\end{axis}
\end{tikzpicture}

\end{document}


yielding But can I get constant spacing in time, similar to: You could make use of the quiver plot handler which is shipped with pgfplots. The quiver plot handler draws arrows at every input sample.

To this end, it requires the input coordinates as usual and arrow coordinates for every input coordinate (i.e. x,y, u, v).

In your case, we could easily sample all required values. Since you have unit vector ratio*=1 1 in your listing, we can normalize all arrows to length 0.1 as follows:

\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}

\begin{document}

\begin{tikzpicture}
\begin{axis}[
width=14cm,
axis lines = middle,smooth,xlabel = $x$, ylabel =$y$, minor tick num =1, grid=both, unit vector ratio*=1 1,enlargelimits = true]
({t^2}, {t^4});

\def\NORM{sqrt((2*t)^2 + (4*t^3)^2)}
u=2*t/\NORM, v=4*t^3/\NORM,
scale arrows=0.1,
}]
({t^2}, {t^4});
\end{axis}
\end{tikzpicture}

\end{document} The \NORM is the vector norm of the vector (u,v); together with scale arrows=0.1, we get the desired effect. Here, we need two \addplot statements: one which draws the plot as such and one which draws merely the arrows.

For comparison, here is the same figure with scale arrows=1: 