
나는 작은 그림을 많이 가지고 있는데 각각은 자신의 그림에서 (0,0)의 중심에 있지만 그것들을 결합해야 하고 결합된 그림에서 첫 번째 그림(범위 내)의 (0,0)은 (4, 2) 두 번째 그림 - 이를 달성하는 가장 좋은 방법은 무엇입니까?
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\filldraw[green](4,5)circle(2pt);
\begin{scope}
\begin{scope}
%Should point at the green dot - (3,2)X and (4,5) should be matched
\draw[red,latex-](0,0)--(3,2);
\end{scope}
\begin{scope}
% Should be at the other end of the red vector (3,2)X and (0,0)XX should be matched
\draw[blue](0,0)circle(5pt);
\end{scope}
\end{scope}
\end{tikzpicture}
\end{document}
좌표 뒤의 X는 이러한 좌표가 다른 범위에 있음을 시각화하기 위해 존재합니다.
추신: 현재 xshift, yshift를 사용하고 있지만 좀 지루합니다.
답변1
다음과 같이 명명된 좌표를 사용합니다.
\coordinate (x) at (4,5);
\coordinate (y) at (3,2);
\filldraw[green](x)circle(2pt);
...
\draw[red,latex-](0,0)--(y);
...
또한 원하는 경우 상대 위치 지정 및 계산을 수행할 수도 있습니다.
여러 TikZ 사진에서 이러한 좌표를 사용하려면 옵션을 사용하세요 remember picture
.
원점을 이동하는 부분은 , 를 사용하는 좌표를 통해 범위를 이동하는 것이 조금 더 쉽습니다 xshift
.yshift
\begin{scope}[shift={(1,3)}]
\draw[red,latex-](0,0)--(3,2);
\end{scope}
하지만 이를 지정하려면 차이점을 알아야 합니다.