# drawing lines using polar axis coordinate system in pgfplots

I would like to draw arrows with polar axis notation in a pgfplots figure that has Cartesian axes with the draw command:

\draw[->] (polar axis cs:radius=1, angle=30) -- (polar axis cs:radius=2, angle=30);


I could not find any way to do something like this in the documentation. Are polar coordinates supported in the axis environment?

• What should be the reference point (origin) for this notation axis cs:0,0 ? Aug 23 '13 at 16:25
• @percusse yes, I would like to define the coordinates with respect to axis cs:0,0 Aug 23 '13 at 16:29
• Could you provide a M(N)WE and specify what output you would like to have? Dec 4 '15 at 15:42

As a simple workaround you could calculate the coordinates with a bit of trigonometry, which can be put in a macro. Note that with compat=1.11 or newer axis cs is the default coordinate system. If you have compat=1.10 or older you need to use (axis cs:\rtheta{1}{30}).

\documentclass[border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\newcommand\rtheta[2]{{#1*cos(#2)},{#1*sin(#2)}}
\begin{document}
\begin{tikzpicture}
\begin{axis}[axis lines=middle,ymin=-1,ymax=1,xmin=-1,xmax=1]
\draw (\rtheta{0}{0}) -- (\rtheta{1}{30}) -- (\rtheta{1}{120});
\end{axis}
\end{tikzpicture}
\end{document}