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 ?
    – percusse
    Aug 23 '13 at 16:25
  • @percusse yes, I would like to define the coordinates with respect to axis cs:0,0
    – gypaetus
    Aug 23 '13 at 16:29
  • 1
    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}).

\begin{axis}[axis lines=middle,ymin=-1,ymax=1,xmin=-1,xmax=1]
\draw (\rtheta{0}{0}) -- (\rtheta{1}{30}) -- (\rtheta{1}{120});

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.