I'm using
\definecolor{kitgreen}{rgb}{0,0.588235294117647,0.509803921568627}
\definecolor{kitblue}{rgb}{0.274509803921569,0.392156862745098,0.666666666666667}
\begin{tikzpicture}
\begin{axis}[%
ycomb,
xmin=0,
xmax=21,
ymin=0,
ymax=1.2,
]
\draw[<->,red] (100,31) -- (100,80); %why does this work?
\draw[<->,blue] (10,0.31) -- (10,0.8); %should work, but doesn't.
\draw[black,dashed] ({rel axis cs:0.95,0}|-{axis cs:0,1}) -- ({rel axis cs:0,0}|-{axis cs:0,1});
\draw[black,dashed] ({rel axis cs:0.95,0}|-{axis cs:0,0.8}) -- ({rel axis cs:0,0}|-{axis cs:0,0.8});
\draw[black,dashed] ({rel axis cs:0.95,0}|-{axis cs:0,0.31}) -- ({rel axis cs:0,0}|-{axis cs:0,0.31});
\addplot+ [semithick,color=black,mark=*,mark options={fill=white}]
table[row sep=crcr]{%
1 0.194\
2 0.18\
4 0.215\
5 0.192\
6 0.189\
8 0.214\
9 0.221\
10 0.176\
11 0.223\
12 0.178\
13 0.199\
14 0.222\
15 0.179\
16 0.229\
17 0.184\
18 0.19\
19 0.175\
20 0.224\
};
\addplot+ [semithick,color=kitgreen,mark=*,mark options={fill=white}]
table[row sep=crcr]{%
3 0.8\
};
\addplot+ [semithick,color=kitblue,mark=*,mark options={fill=white}]
table[row sep=crcr]{%
7 0.31\
};
\end{axis}
\end{tikzpicture}
Why is the red arrow showing correctly (x scaled by 10, y scaled by 100) but the blue one isn't? I would expect the blue arrow at x=10.

\drawetc. inside anaxisdoes not correspond to the axis coordinates. Use(axis cs:1,1)to explicitly use the axis coord system. Or add\pgfplotsset{compat=1.11}to the preamble, with that setting(1,1)and(axis cs:1,1)will work the same, becauseaxis csbecomes default. – Torbjørn T. Jul 26 '21 at 18:11@<username>, e.g. @MarvinNoll, the user will be notified of your comment. You who posted the question is always notified of new comments, other users are not.) – Torbjørn T. Jul 26 '21 at 18:40