1
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[axis equal, ymin=-10,ymax=17,xmin=-10,xmax=30]
        \draw[->] ([shift=(-150:0)]0,0) -- (1,0);
    \end{axis}
\end{tikzpicture}
\end{document}

This should be an arrow from (0,0) to (1,0), but it is actually from some random coordinate to (1,0). It looks like maybe the coordinate shift takes it out of the axis coordinates and into the tikzpicture coordinates. How to prevent this?

User
  • 11
  • 1
    Welcome to TeX.SX! Please post complete, compilable fragments. BTW, if you do not want the shift, why do you add the shift keyword? – Rmano Jun 05 '22 at 17:48
  • That is just to demonstrate that the shift changes the meaning of the coordinate before any shift is applied. – User Jun 05 '22 at 18:20
  • Not sure yet, but: shift uses relative coordinates, so you should say \draw[->] ([shift={(axis direction cs:-1,0)}]0,0) -- (1,0); (see https://tex.stackexchange.com/a/332603/38080) — I am not sure if you have any relative polar cs available, I do not think there is. – Rmano Jun 05 '22 at 18:34
  • That is good for a Cartesian shift, but a direct polar shift is desired. I can compute it I guess, no big deal. – User Jun 05 '22 at 18:52

1 Answers1

1

You need units:

\draw[->] ([shift=(-150:0cm)]0,0) -- (1,0);

enter image description here

Sandy G
  • 42,558
  • +1, but it may be better/more consistent \draw[->] ([shift=(-150pt:0pt)]0,0) -- (1,0); ? – Zarko Jul 06 '22 at 05:36