关注此主题:minipage 和 node 内的高斯曲线我有以下工作示例,但有一个非常具体的问题。我想在双箭头上方包含 sigma,但不包含刻度线(删除线条\node
以查看我在说什么),可以吗?此外,我不太了解节点线中指定的坐标(为什么y
节点的坐标不能是 0.2,而不是像相应的双箭头中那样是 -0.1?)。提前谢谢!请参阅下面的代码:
\documentclass[ignorenonframetext, xcolor={dvipsnames,table}]{beamer}
\mode<presentation> {
\usetheme{Berkeley}
\usecolortheme{dolphin}
\usepackage{tikz} %for transparency
\usetikzlibrary{positioning,shadows,calc}
\usepackage{pgfplots}
\pgfmathdeclarefunction{gauss}{2}{%
\pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}%
}
}
\begin{document}
\begin{frame}
\begin{tikzpicture}
\begin{axis}[
no markers, domain=0:10, samples=100,
axis lines*=left, xlabel=\empty, ylabel=\empty,
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=3cm, width=4.25cm,
xtick={3,6}, ytick=\empty,
xticklabels={\tiny{$\mu$1},\tiny{$\mu$2}},
enlargelimits=false, clip=false, axis on top]
\addplot [fill=pink, draw=none, domain=3.75:4.5] {gauss(3,0.5)}
\closedcycle;
\addplot [fill=pink, draw=none, domain=3:4.5] {gauss(6,1)}
\closedcycle;
\addplot [cyan!50!black] {gauss(3,0.5)};
\addplot [cyan!50!black] {gauss(6,1)};
\addplot[<->] coordinates {(2.25,0.2) (3.75,0.2)};
\node[coordinate, pin={\tiny{$\sigma$1}}] at (axis cs: 3,-0.1){};
\addplot[<->] coordinates {(4.5,0.12) (7.5,0.12)};
\node[coordinate, pin={\tiny{$\sigma$2}}] at (axis cs: 6,-0.17){};
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}
答案1
您可以使用类似的方法\node at (axis cs: 6,0.12) [font=\tiny, inner sep=1pt, above] {$\sigma 2$};
将节点直接放置在您想要的位置。