我试图跟随杰克在 TikZ-PGF 中绘制钟形曲线稍作修改。
1)我只想要在截止处有红色虚线的单变量正态累积分布函数,但不知为何我的虚线看起来很别扭。
2)为什么 y 轴标签位于图的中间,而不是沿着 y 轴?
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\pgfmathdeclarefunction{gauss}{2}{%
\pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
}
\begin{tikzpicture}
\begin{axis}[
no markers, domain=-4:4, samples=100,
axis lines*=left, xlabel=$x$, ylabel=$y$,
every axis y label/.style={at=(current axis.above origin),anchor=south},
every axis x label/.style={at=(current axis.right of origin),anchor=west},
height=4cm, width=7cm,
xtick={-3,-2,-1,0,1,2,3}, ytick=\empty,
enlargelimits=false, clip=false, axis on top,
grid = none
]
\draw[dashed, red, thick] (axis description cs: 1.32,0) -- (axis description cs:1.32, 1);
\addplot [fill=cyan!20, draw=none, domain=-4:1.32] {gauss(0,1)} \closedcycle;
\addplot [very thick,cyan!50!black] {gauss(0,1)};
\end{axis}
\end{tikzpicture}
\end{document}