I am trying to draw this picture using tikzpicture
and "LaTeX -> PS" mode:
However, I am not able to graph a function from 12.802
to 12.806
because these numbers are too small for PGFPlots.
As a reference I took the idea and source code from Plot with magnifying glass, with a different plot in it, so we need to create a box called plotbox
in the preamble and then use it on the tikzpicture
environment of the plot.
This is what I have done so far:
\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\newsavebox\plotbox % To create a magnifying glass. From https://tex.stackexchange.com/a/267834/152550
\begin{lrbox}{\plotbox}
\begin{tikzpicture}
\begin{axis} [
width=3.5cm,
height=3.5cm,
axis on top,
axis lines = center,
xticklabel style = {font=\tiny},
yticklabel style = {font=\tiny},
xlabel = $t$,
ylabel = $f(t)+g(t)$,
xtick={12.802,12.806},
xticklabels={$12.802$,$12.806$},
ytick={-7.006,-6.994},
yticklabels={$-7.006$,$-6.994$},
ymin=-6.994,
ymax=-7.006,
]
\addplot[very thick,red,smooth,samples=201,variable=t,domain=12.802:12.806] {5*sin((2*t-pi/3) r)-8*cos((2*t+pi/6) r)};
\addplot[blue,smooth,samples=201,variable=t,domain=12.802:12.806] {13*sin((2*t+5.24) r)};
\end{axis}
\end{tikzpicture}%
\end{lrbox}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{axis} [
axis on top,
axis lines = center,
axis equal image,
xticklabel style = {font=\tiny},
yticklabel style = {font=\tiny},
xlabel = $t$,
ylabel = $f(t)+g(t)$,
ymin=-13,
ymax=13,
xtick={-13,13},
xticklabels={$-13$,$13$},
ytick={-13,13},
yticklabels={$-13$,$13$},
legend pos=outer north east,
legend style={cells={align=left}},
legend cell align={left},
clip=false
]
\addplot[very thick,red,smooth,samples=201,variable=t,domain=-13:13] {5*sin((2*t-pi/3) r)-8*cos((2*t+pi/6) r)};
\addlegendentry{\(5\sin(2t-\pi/3)-8\cos(2t+\pi/6)\)}
\addplot[blue,smooth,samples=201,variable=t,domain=-13:13] {13*sin((2*t+5.24) r)};
\addlegendentry{\(13\sin(2t+5.24)\)}
% Magnifying glass
\coordinate (spyanchor) at (axis cs:12.804,-7);
\node[circle,draw,inner sep=0pt] at (axis cs:26,-2) (spyplot) {\usebox\plotbox};
\node[circle,draw,inner sep=5pt] at (spyanchor) (spynode) {};
\draw (spyplot) -- (spynode);
\end{axis}
\end{tikzpicture}
\end{center}
\end{document}
As you can see, the big circle and the axis are not centered i.e.:
spy
for that? – user121799 May 19 '19 at 3:04