我希望在一个大圆圈的中心嵌入一个钟形曲线(希望位置有一定的灵活性),但未能实现。以下是我当前的代码。需要帮助!谢谢。
\documentclass{standalone}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{pgfplots}
\newcommand\gauss[2]{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))} % Gauss function, parameters mu and sigma
\usepackage{tikz}
\usepackage{pgfplots}\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}[blue]
\begin{axis}[
axis x line=none,
axis y line=none,
style={mark=,domain=-3:3,samples=50,smooth}, % All plots: from -2:2, 50 samples, smooth, no marks
]
\addplot[domain=-3:3, blue, thick]{\gauss{0}{0.75}};
\draw[thick] (0,0.275) circle (2.5cm);
\end{axis};
\end{tikzpicture}
\end{document}
答案1
这是一个不涉及axis
环境的解决方案,它会导致恼人的坐标偏移:
\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{amsmath}
\newcommand\gauss[2]{1/(#2*sqrt(2*pi))*2.718^(-((\x-#1)^2)/(2*#2^2))} % Gauss function, parameters mu and sigma
\begin{document}
\begin{tikzpicture}[blue]
%\draw[help lines] (-3,-3) grid (3,3);
\begin{scope}
\clip (0,0) circle (2.5);
\draw[thick,yshift=-1.75cm,scale=2.5,domain=-3:3, smooth, blue] plot ({\x}, {\gauss{0}{0.28}});
\end{scope}
\draw[thick] (0,0) circle (2.5);
\end{tikzpicture}
\end{document}
当然,您可以使用参数、缩放比例和yshift
绘图线。