答案1
除了没有 MWE 之外,我认为这在原则上是一个有趣的问题。正如 Jojo 指出的那样,人们可以spy
在这里使用。然而,有两个稍微不平凡的方面:
- 如何通过切线连接间谍节点?
- 如何监视间谍节点?
第一个子问题已经得到解决这里但我使用以下方法简化了答案这一观察.现在可以使用
\spy [size=1cm,tangent connect] on (0,0) in node [below] at (1,-1);
得到切线连接。至于第二个子问题,我认为答案是众所周知的,但我在这个网站(或其他地方)没有找到这个简单的答案:只需使用不同的范围。当然,我可能只是错过了。无论如何,这里有一个代码。(不用说,我不明白轴标签。)
\documentclass[tikz,border=3mm]{standalone}
\usepackage{dsfont}% you can also use amsfonts but I personally like
% the dsfont double-stroke letters a little bit better
\usetikzlibrary{calc,spy}
\begin{document}
\begin{tikzpicture}[spy using outlines={circle, magnification=4,size=2cm,connect spies},
tangent connect/.style={spy connection path={
\draw[thin] let \p1=(tikzspyonnode.center),\p2=(tikzspyonnode.north),
\p3=(tikzspyinnode.center),\p4=(tikzspyinnode.north),
\n1={atan2(\y3-\y1,\x3-\x1)}, % slope between circle centers
\n2={veclen(\y3-\y1,\x3-\x1)},
\n3={atan2(\y4-\y3-\y2+\y1,\n2)} % additional slope because of different radii
in
(tikzspyonnode.\n3+\n1+90) -- (tikzspyinnode.\n3+\n1+90)
(tikzspyonnode.-\n3+\n1-90) -- (tikzspyinnode.-\n3+\n1-90);}}]
\begin{scope}[spy using outlines={circle, magnification=4,size=2cm,connect spies}]
\draw[-stealth] (-2.5,0) -- (5,0) node[right]{$-x^2$};
\draw[-stealth] (0,-1.5) -- (0,1.5)node[left]{$\mathds{C}$};
\draw[trig format=rad] plot[domain=-2.5:4.6,smooth,samples=151]
(\x,{0.5*sin(pi*\x)});
\spy [size=1cm,tangent connect] on (0,0) in node [below] at (1,-1);
\spy [size=1cm,tangent connect] on (4.5,0.5) in node at (5.5,1.3);
\end{scope}
\spy [size=1cm,tangent connect] on (5.5,1.3) in node at (6.8,1.6);
\end{tikzpicture}
\end{document}
并且不在(内部)间谍范围内的事物不会被(内部)间谍所监视。(当然,这里的事情特别简单,因为一切都是黑色的,所以绘制顺序并不重要。在更复杂的设置中,可能需要使用图层,这在 的上下文中有些不简单spy
。)
\documentclass[tikz,border=3mm]{standalone}
\usepackage{dsfont}% you can also use amsfonts but I personally like
% the dsfont double-stroke letters a little bit better
\usetikzlibrary{calc,spy}
\begin{document}
\begin{tikzpicture}[spy using outlines={circle, magnification=4,size=2cm,connect spies},
tangent connect/.style={spy connection path={
\draw[thin] let \p1=(tikzspyonnode.center),\p2=(tikzspyonnode.north),
\p3=(tikzspyinnode.center),\p4=(tikzspyinnode.north),
\n1={atan2(\y3-\y1,\x3-\x1)}, % slope between circle centers
\n2={veclen(\y3-\y1,\x3-\x1)},
\n3={atan2(\y4-\y3-\y2+\y1,\n2)} % additional slope because of different radii
in
(tikzspyonnode.\n3+\n1+90) -- (tikzspyinnode.\n3+\n1+90)
(tikzspyonnode.-\n3+\n1-90) -- (tikzspyinnode.-\n3+\n1-90);}}]
\begin{scope}[spy using outlines={circle, magnification=4,size=2cm,connect spies}]
\draw[trig format=rad] plot[domain=-2.5:4.6,smooth,samples=151]
(\x,{0.5*sin(pi*\x)});
\spy [size=1cm,tangent connect] on (0,0) in node [below] at (1,-1);
\spy [size=1cm,tangent connect] on (4.5,0.5) in node at (5.5,1.3);
\end{scope}
\draw[-stealth] (-2.5,0) -- (5,0) node[right]{$-x^2$};
\draw[-stealth] (0,-1.5) -- (0,1.5)node[left]{$\mathds{C}$};
\spy [size=1cm,tangent connect] on (5.5,1.3) in node at (6.8,1.6);
\end{tikzpicture}
\end{document}