# [Tex/LaTex] Quiver plot in polar coordinates

pgfplotstikz-pgf

I need to plot an analytically given vector field in polar coordinates. I would like to get something like the picture in this answer by Christian FeuersÃ¤nger, but in circular axes. I tried to use the polaraxis environment plus the addplot3 command of the pgfplots package to achieve this, but I wasn't succeeded to understand how does the quiver option work in this context. Could you please help me?

In polar coordinates, like in cartesian coordinates, the components given in u and v are added to the coordinate of the point.

So if you plot u=10, v=0, you get arrows that end 10Â° clockwise from where they start, at the same distance from the centre as the starting point:

If you plot u=0, v=0.1, you get arrows pointing outward from the centre (because the angles of the starting and end points are the same):

If you want the arrows to start on a cartesian grid, set data cs=cart:

If you want to draw the same quiver (in terms of cartesian coordinates) at every point, you need to find the appropriate offset in terms of angle and radius. You can do that using

    quiver={
% Draw constant quivers (0.1, 0.2)
% Angle of vector pointing to quiver end minus angle of vector pointing to quiver start
u={atan2( y+0.2, x+0.1)) - atan2(y,x) },
% Length of vector pointing to quiver end minus length of vector pointing to quiver start
v={veclen(y+0.2, x+0.1) - veclen(y,x) }
}


\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}
samples=13,
samples y=10,
quiver={
u={10},
v={0.1},
},
-latex,
domain=0:360,
domain y=0:1] {0};
\end{polaraxis}
\end{tikzpicture}
\end{document}


Arrows on cartesian grid:

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[ymax=1]
samples=15,
samples y=15,
quiver={
u={10},
v={-0.1},
},
-latex,
domain=-1:1,
domain y=-1:1,
data cs=cart
] (x, y, 0);
\end{polaraxis}
\end{tikzpicture}
\end{document}


\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[ymax=1,]
samples=9,
samples y=9,
quiver={
% Draw constant quivers (0.1, 0.2)
% Angle of vector pointing to quiver end minus angle of vector pointing to quiver start
u={atan2( y+0.2, x+0.1)) - atan2(y,x) },
% Length of vector pointing to quiver end minus length of vector pointing to quiver start
v={veclen(y+0.2, x+0.1) - veclen(y,x) }
},
-latex,
domain=-1:1,
domain y=-1:1,
data cs=cart
] (x, y, 0);
\end{polaraxis}
\end{tikzpicture}
\end{document}


Constant quivers

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}[ymax=1,]
samples=9,
samples y=9,
quiver={
% Draw constant quivers (0.1, 0.2)
% Angle of vector pointing to quiver end minus angle of vector pointing to quiver start
u={atan2( y+0.2, x+0.1)) - atan2(y,x) },
% Length of vector pointing to quiver end minus length of vector pointing to quiver start
v={veclen(y+0.2, x+0.1) - veclen(y,x) }
},
-latex,
domain=-1:1,
domain y=-1:1,
data cs=cart
] (x, y, 0);
\end{polaraxis}
\end{tikzpicture}
\end{document}