使用 tikz 绘制第二和第三 x 轴

使用 tikz 绘制第二和第三 x 轴

这就是我想要画的: 在此处输入图片描述

到目前为止,在使用 TikZ 绘制单位圆和正弦波图表以下代码:

\documentclass[a4paper]{article}% guessing (cfr)
\usepackage[landscape,scale=.9]{geometry}
\usepackage{tikz}
\usetikzlibrary{datavisualization.formats.functions,backgrounds,calc}
\usetikzlibrary{quotes,angles}
\def\mytypesetter#1{% page 813
  \pgfmathparse{#1/pi}%
  \pgfmathprintnumber{\pgfmathresult}$\pi$%
}
\begin{document}% added - surely necessary! (cfr)
  \centering
  \begin{tikzpicture}[scale=4,cap=round,>=latex,baseline={(0,0)}]
    \draw[->] (-1.5cm,0cm) -- (1.5cm,0cm) node[right,fill=white] {$t$ / tE};
    \draw[->] (0cm,-1.5cm) -- (0cm,1.5cm) node[above,fill=white] {$s$ / sE};

    \draw[thick] (0cm,0cm) circle(1cm);

 \draw
    (0,0) coordinate (a) 
    -- (0.5,0) coordinate (b)
    -- (0.5,.86) coordinate (c) node[midway, right] {$s(t)$}
    --(0.0,0) coordinate (d)
    --(0.0,1) coordinate (e) node[midway, right] {$r$}
    pic["$\varphi$", draw=orange, <->, angle eccentricity=1.2, angle radius=1cm]
    {angle=b--a--c}
    ;
 \draw[thick,red,dashed](0 cm, 1 cm)--(3.5 cm, 1 cm)  ;
  \draw[thick,red,dashed](0 cm, -1 cm)--(3.5 cm, -1 cm)  ;
   \draw[thick,blue,dotted](0 cm, .86 cm)--(2.52 cm, .86 cm)  ;
    \begin{scope}[xshift=20mm]
      \datavisualization
      [
      school book axes,
      y axis={unit length=10mm},
      x axis={unit length=2.5mm, ticks={step=(.5*pi), tick typesetter/.code=\mytypesetter{##1}}},
      visualize as smooth line,
      ]
      data [format=function] {
        var x : interval [0:2*pi];
        func y = sin(\value x r);
      };
    \end{scope}

  \end{tikzpicture}
\end{document}

结果是:

在此处输入图片描述

但我不知道如何添加第二/第三轴。

答案1

在此处输入图片描述

\documentclass[tikz, margin=3mm]{standalone}
\usetikzlibrary{angles, arrows.meta,
                backgrounds,
                calc,
                quotes}

\begin{document}
    \begin{tikzpicture}[scale=4]
% polar
\draw[->] (-1.5cm,0cm) -- (1.5cm,0cm) node[right] {$t$ / tE};
\draw[->] (0cm,-1.5cm) -- (0cm,1.5cm) node[above] {$s$ / sE};
%
\draw   (0cm,0cm) circle(1cm);
% vector, angle
\draw[thick]   
        (0,0)   coordinate (a)   to 
        (0.5,0) coordinate (b)   to ["$s(t)$"] 
        (0.5,.86) coordinate (c) to ["$r$" '] (a)
        (0, 1)  coordinate (d)
        (0,-1)  coordinate (e)
    pic["$\varphi$", draw=orange, <->, angle eccentricity=1.2, angle radius=1cm]
    {angle=b--a--c};
% time axes
\draw[->] (2,0) -- (6,0) node[right] {$t$};
\draw[->] (2.5,-1.5) -- (2.5,1.5) node[above] {$s$};
\foreach \i/\j in {0.25*pi/{T/2}, 0.75*pi/{T}}
    \draw (\i+2.5,1pt) -- ++ (0,-2pt) node[below] {$\j$};
% time function
\draw[thick] plot [domain=0:2*pi,samples=101] (0.5*\x+2.5,{sin(\x r)});
% phase axe
\draw[->] (2.5,-0.6) -- ++ (3.5,0) node[right] {$\varphi$};
\foreach \i/\j [count=\x] in {90/{\pi/2},180/{3\pi/4},
                              270/{3\pi/4},360/{2\pi} }
    \draw   (0.25*pi*\x+2.5,-0.6cm+1pt) node[above] {\i} -- ++
            (0,-2pt) node[below] {$\j$};
% unit borders
\draw[red,dashed]   (d) -- (d -| 6,0)
                    (e) -- (0,-1 -| 6,0);
\draw[blue,dotted]   (0,.86) -- (3.5,0.86);
  \end{tikzpicture}
\end{document}

相关内容