I'm trying to do some annotation with TikZ in a PGFplots axis environment by means of nodes. However, the placement of the nodes is going wrong all the time, see the minimum working example below. How can I fix this? How do I calculate the coordinates for the TikZ annotation properly?
MWE:
\documentclass[margin=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
xtick={-0.1,0,1,1.1},xmin=-0.1,xmax=1.1,xlabel=$x$,
ytick={-0.2,0,2,2.2},ymin=-0.2,ymax=2.2,ylabel style={rotate=-90},ylabel=$y$,
unit vector ratio=2 1 1,
]
\addplot[blue,domain=0:1] {x};
\addplot[red,domain=0:1] {2*x};
% Annotation.
\coordinate (SW) at (axis cs:-0.1,-0.2); % (S)outh (w)est.
\coordinate (SE) at (axis cs:1.1,-0.2); % (S)outh (e)ast.
\coordinate (NE) at (axis cs:1.1,2.2); % (N)orth (e)ast.
\coordinate (NW) at (axis cs:-0.1,2.2); % (N)orth (w)est.
\coordinate (A) at (axis cs:1,0);
\fill[black] (A) circle (1pt) node[anchor=south]{A};
% ??? WHY IS THIS NOT WORKING. SHOULD BE THE SAME AS NODE A. ???
\coordinate (B) at ($(SE)+(axis cs:-0.1,0.2)$); % ??? WHY IS THIS NOT WORKING. SHOULD BE THE SAME AS NODE A. ???
\fill[black] (B) circle (1pt) node[anchor=south east]{B}; % ??? WHY IS THIS NOT WORKING. SHOULD BE THE SAME AS NODE A. ???
% ??? WHY IS THIS NOT WORKING. SHOULD BE THE SAME AS NODE A. ???
\end{axis}
\end{tikzpicture}
\end{document}



axis cscoordinate system fornodes? – Ignasi May 12 '15 at 09:57xminandyminvalues (with possiblyclip=falseadded) and you'll see that B would be dancing around. – percusse May 12 '15 at 09:59$$in($(1,0)$), just write(1,0). – Alenanno May 12 '15 at 10:03axis csis the default within the axis environment, according to thePGFplotsmanual. See4.17 Custom annotations,PGFplotsmanual Revision 1.12 (2015/01/31). Nonetheless, it is indeed more consistent to useaxis cseverywhere, so I edited the code ;). Thanks for your suggestion. – Adriaan May 12 '15 at 11:17\usetikzlibrary{calc}. Just left overs from me playing around with the calculations. – Adriaan May 12 '15 at 11:18pgfplotsaxis environment? – Adriaan May 12 '15 at 11:20pgfplotsand not only positioning nodes. – Ignasi May 12 '15 at 12:28