我正在尝试绘制填充到某个点的标准正态分布$z_\alpha$
,问题是 \tkzPointShowCoord 标签没有出现在图中,以下是我使用的代码:
\newcommand\gauss[2]{1/(sqrt(2*pi*#2))*exp(-((x-#1)^2)/(2*#2))} % normal random variable
\begin{tikzpicture}[scale=0.7]
\begin{axis}[every axis plot post/.append style={
mark=none,domain=-3:3,samples=50,smooth, very thick},
axis x line*=bottom, % no box around the plot, only x and y axis
axis y line*=left, % the * suppresses the arrow tips
enlargelimits=upper,
legend style={draw=none, nodes={scale =.8}, at={(1.7,1.2)}},
legend cell align={left}] % extend the axes a bit to the right and top
\addplot[smooth,blue, name path=f]{\gauss{0}{1}};
\path [name path=xaxis]
(\pgfkeysvalueof{/pgfplots/xmin},0) --
(\pgfkeysvalueof{/pgfplots/xmax},0);
\addplot[red!10, opacity=0.8] fill between [of=f and xaxis, soft clip={domain=-5:1}];
\tkzDefPoint(1,.2419){L}
\tkzPointShowCoord[noydraw=true, xlabel=$z_\alpha$](L)
\legend{$\mu =0~ \sigma^2 = 1$}
\end{axis}
\end{tikzpicture}
提前感谢你的帮助
答案1
我在另一篇文章中找到了答案 使用 Tikz 图形包时隐藏或放错节点标签
基本上,我必须使用添加标签\node
并添加clip=false
样式部分。