我正在绘制一个函数图,我想在轴上标记两个点。其中一个点标记正确,但另一个点显示的是数字 4,而不是相应的字母。我该如何解决这个问题?
\documentclass{report}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle,
xlabel=$x$,
ylabel=$f_X(x)$,
ymin=0,
ymax=0.6,
xmax=8,
samples=100,
domain=-2:10,
every axis x label/.style={at={(current axis.right of origin)},anchor=west},
every axis y label/.style={at={(current axis.above origin)},anchor=south},
yticklabels={},
xticklabel={$\mu$},
xtick={4},
]
\pgfmathsetmacro{\mu}{4}
\pgfmathsetmacro{\theta}{1}
\addplot[blue, thick] {1/(sqrt(2*pi*\theta^2))*exp(-1/(2*\theta^2)*(x-\mu)^2)};
\node[below] at (axis cs:\mu, 0) {$\sim$};
\node[left] at (axis cs:0, {1/(sqrt(2*pi*\theta^2))}) {$\frac{1}{\sqrt{2\pi\theta^2}}$};
\draw[dashed] (axis cs: \mu,0) -- (axis cs: \mu, {1/(sqrt(2*pi*\theta^2))});
\end{axis}
\end{tikzpicture}
\end{document}