将箭头(\draw)添加到 pgfplot

将箭头(\draw)添加到 pgfplot

我在用着

\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}

为什么红色箭头显示正确(x 缩放 10,y 缩放 100),而蓝色箭头显示不正确?我期望蓝色箭头位于 x=10 处。

结果

相关内容