# How to plot something like this in latex

I would like to graph something like this in latex or R, but my main goal is to do it in Latex.

Thanks for the help

• Welcome to TeX.sx! On this site, a question should typically revolve around an abstract issue (e.g. "How do I get a double horizontal line in a table?") rather than a concrete application (e.g. "How do I make this table?"). Questions that look like "Please do this complicated thing for me" tend to get closed because they are "too localized". Please try to make your question clear and simple by giving a minimal working example (MWE): you'll stand a greater chance of getting help. Commented Apr 21, 2018 at 21:43

I was unable to see a precise relation between the phases indicated on the circles and the phases between the sines. Other than that it is straightforward to realize something like this with TikZ.

\documentclass[border=3.14mm,tikz]{standalone}
\usetikzlibrary{fit}
% inspired by https://tex.stackexchange.com/a/423952/121799
\tikzset{boxed/.style={path picture={
\coordinate (ll) at (path picture bounding box.south west);
\coordinate (ur) at (path picture bounding box.north east);
},
}}
\begin{document}
\begin{tikzpicture}[font=\sffamily,variable=\x,samples=100]
\node[anchor=west] at (0,0) (outphase) {$x$ \& $y$ out of phase};
\node[anchor=east] at (\linewidth,0) (inphase) {$x$ \& $y$ in phase};
% upper left
\begin{scope}[shift={(0.5cm,-2cm)},scale=0.8]
\draw[boxed] plot[domain=0:4] ({\x},{sin(pi*deg(\x))});
\node[draw,fit=(ll) (ur)] (plottl) {};
\draw[red] plot[domain=0:4] ({\x},{0.8*sin(pi*deg(\x-0.8))});
%
\begin{scope}[xshift=6cm,scale=0.65,font=\footnotesize\sffamily]
\draw (0,0) circle (1cm);
\draw (0,-1) -- (0,1) node[above]{$+\pi/2$};
\draw (1,0) -- (-1,0) node[left]{$+\pi$};
\draw[-latex] (0,0) -- ({(pi-0.5)*180/pi}:1);
\end{scope}
%
\begin{scope}[yshift=-2cm]
\node[anchor=west] (texttl) at (0.5,0) {leading: $y$ (\textcolor{red}{---}), lagging: $x$ (---)};
\end{scope}
% upper right
\end{scope}
\begin{scope}[shift={({0.5cm+\linewidth/2},-2cm)},scale=0.8]
\begin{scope}[xshift=2.5cm]
\draw[boxed] plot[domain=0:4] ({\x},{sin(pi*deg(\x+0.1))});
\node[draw,fit=(ll) (ur)] (plottr) {};
\draw[red] plot[domain=0:4] ({\x},{0.8*sin(pi*deg(\x))});
\end{scope}
%
\begin{scope}[xshift=1.5cm,scale=0.65,font=\footnotesize\sffamily]
\draw (0,0) circle (1cm);
\draw (0,-1) -- (0,1) node[above]{$+\pi/2$};
\draw (1,0) -- (-1,0) node[left]{$+\pi$};
\draw[-latex] (0,0) -- ({(0.3)*180/pi}:1);
\end{scope}
%
\begin{scope}[yshift=-2cm]
\node[anchor=west] (texttr) at (0.5,0) {leading: $x$ (---), lagging: $y$ (\textcolor{red}{---})};
\end{scope}
\end{scope}
% lower left
\begin{scope}[shift={(0.5cm,-6.5cm)},scale=0.8]
\draw[boxed] plot[domain=0:4] ({\x},{sin(pi*deg(\x))});
\node[draw,fit=(ll) (ur)] (plotbl) {};
\draw[red] plot[domain=0:4] ({\x},{0.8*sin(pi*deg(\x-1.2))});
%
\begin{scope}[xshift=6cm,scale=0.65,font=\footnotesize\sffamily]
\draw (0,0) circle (1cm);
\draw (0,-1) -- (0,1) node[above]{$+\pi/2$};
\draw (1,0) -- (-1,0) node[left]{$+\pi$};
\draw[-latex] (0,0) -- ({(pi+0.5)*180/pi}:1);
\end{scope}
%
\begin{scope}[yshift=2cm]
\node[anchor=west] (textbl) at (0.5,0) {leading:  $x$ (---), lagging: $y$ (\textcolor{red}{---})};
\end{scope}
% lower right
\end{scope}
\begin{scope}[shift={({0.5cm+\linewidth/2},-6.5cm)},scale=0.8]
\begin{scope}[xshift=2.5cm]
\draw[boxed] plot[domain=0:4] ({\x},{sin(pi*deg(\x+0.1))});
\node[draw,fit=(ll) (ur)] (plotbr) {};
\draw[red] plot[domain=0:4] ({\x},{0.8*sin(pi*deg(\x+0.2))});
\end{scope}
%
\begin{scope}[xshift=1.5cm,scale=0.65,font=\footnotesize\sffamily]
\draw (0,0) circle (1cm);
\draw (0,-1) -- (0,1) node[above]{$+\pi/2$};
\draw (1,0) -- (-1,0) node[left]{$+\pi$};
\draw[-latex] (0,0) -- ({(-0.3)*180/pi}:1);
\end{scope}
%
\begin{scope}[yshift=2cm]
\node[anchor=west] (textbl) at (0.5,0) {leading: $y$ (\textcolor{red}{---}), lagging: $x$ (---)};
\end{scope}
\end{scope}
\node[fit=(plotbr) (outphase) (inphase)] (Box){};
\path (inphase) -- (plottl.north) coordinate[midway] (X1);
\path (texttl) -- (textbl) coordinate[midway] (X2);
\path (texttl) -- (texttr) coordinate[midway] (X3);
\draw (Box.west |- X1) -- (Box.east |- X1);
\draw (Box.west |- X2) -- (Box.east |- X2);
\draw (Box.north -| X3) -- (Box.south -| X3);
\end{tikzpicture}
\end{document}