我尝试了https://tex.stackexchange.com/a/129307/21557放大图像的一部分而不放大线宽。我也不想放大点。但是在我的示例中,该点也被放大了(见下文)。我该如何避免这种情况?
我还想在放大的部分内绘制其他内容,我的例子是上面的一个角度。我该如何解释该部分的单位?
\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{calc,decorations.markings}
\tikzset{
tangent/.style={
decoration={
markings,% switch on markings
mark=
at position #1
with
{
\coordinate (tangent point-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,0pt);
\coordinate (tangent unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (1,0pt);
\coordinate (tangent orthogonal unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,1);
}
},
postaction=decorate
},
use tangent/.style={
shift=(tangent point-#1),
x=(tangent unit vector-#1),
y=(tangent orthogonal unit vector-#1)
},
use tangent/.default=1
}
\usetikzlibrary{calc,positioning,angles}
\begin{document}
\begin{tikzpicture}[
% Style for the spy nodes and the connection line
spy/.style={%
draw,orange,
line width=1pt,
circle,inner sep=0pt,
},
]
% Parameters
%% size of the spy-in nodes
\def\spyviewersize{4.25cm}
%% (line width of the spy nodes) / 2
%% we need this for clipping later
\def\spyonclipreduce{0.5pt}
%% first zoom
%%% factor
\def\spyfactorI{20}
%%% spy in point
\coordinate (spy-in 1) at (8,0);
%%% spy on point
\coordinate (spy-on 1) at (20:3);% sould be on the curve
%% the graph/picture
\def\pik{
\pgfmathsetmacro{\al}{20}
\draw[tangent={\al/360}] (0,0) circle (3);
\draw[use tangent,green] (-2,0) -- (2,0) coordinate (XA);
\draw[use tangent,red] (-2,0.3) -- (2,-0.3) coordinate (XB);
\fill (\al:3) circle (0.05) coordinate (P) node[right]{$P$};
}
% draw the original picture
\pik
% first zoom
%% spy on node
\node[spy,minimum size={\spyviewersize/\spyfactorI}] (spy-on node 1) at (spy-on 1) {};
%% spy in node
\node[spy,minimum size=\spyviewersize] (spy-in node 1) at (spy-in 1) {};
\begin{scope}
\clip (spy-in 1) circle (0.5*\spyviewersize-\spyonclipreduce);
\pgfmathsetmacro\sI{1/\spyfactorI}
\begin{scope}[
shift={($\sI*(spy-in 1)-\sI*(spy-on 1)$)},
scale around={\spyfactorI:(spy-on 1)},
]
\pik
%%
\pic [pic text=$\varphi$,draw,angle radius=50,blue,fill,fill
opacity=0.5]{angle=XB--P--XA};
%% How to interpret the measure 50 for the angle radius
\end{scope}
\end{scope}
%% connect the nodes
\draw [spy] (spy-on node 1) -- (spy-in node 1);
\end{tikzpicture}
\end{document}
答案1
您应该使用具有圆形的节点而不是“真实”圆形的节点,因为该节点不会缩放:
\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{calc,decorations.markings,positioning,angles}
\tikzset{
tangent/.style={
decoration={
markings,% switch on markings
mark=
at position #1
with
{
\coordinate (tangent point-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,0pt);
\coordinate (tangent unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (1,0pt);
\coordinate (tangent orthogonal unit vector-\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}) at (0pt,1);
}
},
postaction=decorate
},
use tangent/.style={
shift=(tangent point-#1),
x=(tangent unit vector-#1),
y=(tangent orthogonal unit vector-#1)
},
use tangent/.default=1
}
\begin{document}
\begin{tikzpicture}[
% Style for the spy nodes and the connection line
spy/.style={%
draw,orange,
line width=1pt,
circle,inner sep=0pt,
},
]
% Parameters
%% size of the spy-in nodes
\def\spyviewersize{4.25cm}
%% (line width of the spy nodes) / 2
%% we need this for clipping later
\def\spyonclipreduce{0.5pt}
%% first zoom
%%% factor
\def\spyfactorI{20}
%%% spy in point
\coordinate (spy-in 1) at (8,0);
%%% spy on point
\coordinate (spy-on 1) at (20:3);% sould be on the curve
%% the graph/picture
\def\pik{
\pgfmathsetmacro{\al}{20}
\draw[tangent={\al/360}] (0,0) circle (3);
\draw[use tangent,green] (-2,0) -- (2,0) coordinate (XA);
\draw[use tangent,red] (-2,0.3) -- (2,-0.3) coordinate (XB);
\node[fill,circle,inner sep=1pt,label={0:$P$}] (P) at (\al:3) {}; % <- change real circle to node
}
% draw the original picture
\pik
% first zoom
%% spy on node
\node[spy,minimum size={\spyviewersize/\spyfactorI}] (spy-on node 1) at (spy-on 1) {};
%% spy in node
\node[spy,minimum size=\spyviewersize] (spy-in node 1) at (spy-in 1) {};
\begin{scope}
\clip (spy-in 1) circle (0.5*\spyviewersize-\spyonclipreduce);
\pgfmathsetmacro\sI{1/\spyfactorI}
\begin{scope}[
shift={($\sI*(spy-in 1)-\sI*(spy-on 1)$)},
scale around={\spyfactorI:(spy-on 1)},
]
\pik
%%
\pic[draw,angle radius=50,fill=blue!50,pic text=$\varphi$]{angle=XB--P--XA};
%% How to interpret the measure 50 for the angle radius
\end{scope}
\end{scope}
%% connect the nodes
\draw [spy] (spy-on node 1) -- (spy-in node 1);
\end{tikzpicture}
\end{document}
结果:
编辑:修改了角度的颜色和标签的代码,以使标签不透明。