我在同时使用 spy 和定位 tikzlibraries 时遇到问题。启用定位后,spypoint 和放大镜的轮廓位置不正确。在示例中,红色圆圈是手动绘制在正确位置的,黑色圆圈是由 spy 函数自动绘制的。当定位部分启用时,问题消失\node[
below right=1cm and 1cm of nodeA.north east
...
已关闭。有什么想法,如何修复?提前致谢。干杯,哈根。
\documentclass[11pt]{book}
\usepackage{amsmath}
\usepackage{tikz,pgfplots}
\usetikzlibrary{positioning}
\usetikzlibrary{spy}
\pgfplotsset{compat=1.16}
\begin{document}
\begin{tikzpicture}[every text node part/.style={align=center}]
\node (nodeA) {};
\node[below right=1cm and 1cm of nodeA.north east] (nodeB) {
\begin{tikzpicture}
\begin{scope}[spy using outlines={circle,magnification =2}, connect spies]
\begin{axis}[domain=0:2*pi]
\addplot {sin(deg(x))};
\coordinate (spypoint) at (axis cs:pi/2,1);
\coordinate (magnifyglass) at (axis cs:pi/2,-0.5);
\end{axis}
\spy[size=2cm] on (spypoint) in node at (magnifyglass);
\draw[red] (spypoint) circle (0.5cm);
\draw[red] (magnifyglass) circle (1cm);
\end{scope}
\end{tikzpicture}
};
\end{tikzpicture}
\end{document}