我正在尝试绘制如下图所示的内容。
到目前为止,我有以下 MWE。任何帮助都非常欢迎。
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{%
compat=1.12,
compat/show suggested version=false,
%enlargelimits=false
}
\begin{document}
\begin{tikzpicture}
\begin{axis}[samples=200,smooth,hide axis]
\addplot[domain=0:360] {abs(sin(2*x))};
\addplot[domain=2*360:3*360] {0.5*abs(sin(x))};
\addplot[domain=4*360:5*360] {abs(sin(2*x))*(x<4.25*360)};
\addplot[domain=4*360:5*360] {abs(sin(2*x))*(x>4.75*360)};
\addplot[domain=4*360-360/8:4*360+360/2.65,red] {0.5*abs(sin(x-360/2.65))};
\addplot[domain=5*360-360/8:5*360+360/2.65,red] {0.5*abs(sin(x-360/2.65))};
\end{axis}
\end{tikzpicture}
\end{document}
答案1
使用 TikZ:
\documentclass[border=5pt]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\begin{scope}
\clip
(0,4) rectangle (16,0);
\foreach \Value in {1.5,2.5,3.5,4.5,12,14}
\draw[fill=red] (\Value,0) ellipse [x radius=0.5,y radius=2];
\foreach \Value in {7,9}
\draw[fill=red] (\Value,0) ellipse [x radius=1,y radius=1.3];
\foreach \Value in {12,14}
\draw[dotted] (\Value,0) ellipse [x radius=1,y radius=1.3];
\end{scope}
\draw[-latex] (-0.5,0) -- (16,0) node[below=2pt] {BB};
\draw[-latex] (0,-0.5) -- (0,3) node[left=2pt] {BB};
\foreach \Value in {1,...,15}
\draw (\Value,-2pt) -- (\Value,2pt);
\foreach \Value in {3,8,12.5}
\node[below] at (\Value,-2pt) {AA};
\draw[dashed] (1,2) -- (14,2);
\draw[dashed] (6,1.3) -- (10,1.3);
\draw[latex-latex] (8,1.3) -- (8,2);
\draw[shorten >= 2pt] (7.5,2.5) node[above] {AA} |- (8,1.65);
\foreach \Value [count=\xi] in {5,10}
\draw[-latex] ([xshift=10pt]\Value,1) -- coordinate (aux\xi) ++(0.8,0);
\foreach \Value in {1,2}
\draw[shorten >= 2pt] (aux\Value|-7.5,2.5) node[above] {AA} -- (aux\Value);
\end{tikzpicture}
\end{document}
答案2
你也可以使用arc
命令来代替剪切椭圆,例如
\draw (0,0) arc[start angle=0,end angle=180, x radius=0.5, y radius=2];