3

I am trying to understand why the direction of the red arrow changes in the presence of the addplot line in the following example:

\documentclass[]{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.18}


\begin{document}
        \begin{tikzpicture}
    \begin{axis}[unit vector ratio={1 1},
        xmin=0,xmax=1.05,ymin=0,ymax=1.05,%
        clip=true,
        ]
    \draw[fill=yellow] (.2,1) coordinate (x) circle (2pt);
    \addplot[domain=0.01:.9,variable=t,samples=20] ({1/2*(ln(.3/t) - ln(1-.6))},{1/2*(ln( (1-.3)/(1-t) ) - ln(1-.6))});
    \draw[red,->] (x) -- ++(-.1,-.1);
    \end{axis}
    \end{tikzpicture}

\end{document}

Clearly, it is no longer going south west as intended. Can anyone explain what's going on here, and how I can fix it?

enter image description here

1 Answer 1

4

like this ? Pay attention to axis direction cs

enter image description here

\documentclass[]{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=1.18}

\begin{document}
    \begin{tikzpicture}
    \begin{axis}[unit vector ratio={1 1},
        xmin=0,xmax=1.05,ymin=0,ymax=1.05,%
        clip=true,
        ]
    \draw[fill=yellow] (.2,1) coordinate (x) circle (2pt);
    \addplot[domain=0.01:.9,variable=t,samples=20] ({1/2*(ln(.3/t) - ln(1-.6))},{1/2*(ln( (1-.3)/(1-t) ) - ln(1-.6))});
    \draw[red,->] (x) -- ++(axis direction cs:-.1,-.1);
    \end{axis}
    \end{tikzpicture}
\end{document}
3
  • This seems to be doing the trick, thanks! Any chance you could also help me understand what is going on? I would like to find a way to set this coordinate system "as the default" because I have many commands that follow, and writing axis direction cs: in front of all coordinates will be quite messy.
    – mimuller
    Apr 12 at 12:30
  • 1
    @mimuller To set axis direction cs as the default coordinate system in pgfplots, use \pgfplotsset{every axis plot post/.append style={axis direction cs}} in your preamble. This makes all coordinates interpret as axis-direction specific by default.
    – JeT
    Apr 12 at 13:07
  • It does not compile when I add this to the preamble (right after compat=1.18). It says it doesn't know the key 'tikz/axis direction cs'. I am also worried about this then in turn messing up the absolute coordinates, which I understand must be entered in 'axis cs'...
    – mimuller
    Apr 12 at 14:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .