tikzpicture를 사용하여 축을 올바르게 회전하는 방법

tikzpicture를 사용하여 축을 올바르게 회전하는 방법

나는 그들 사이에 오프셋과 회전이 있는 두 개의 좌표 프레임을 가지고 있습니다.

다음 예를 사용하여 시각화해 보았습니다.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\begin{document}

\begin{tikzpicture}[thick]
    \draw[-latex] (0,0) -- (4,0)  node[right, text width=5em] {$X$};
    \draw[-latex] (0,0) -- (0,4)  node[right, text width=5em] {$Y$};

    \begin{scope}[rotate=0,draw=red]
        \draw[->] (3,2) -- (7,2)  node[right, text width=5em] {$X'$};
        \draw[->] (3,2) -- (3,6)  node[right, text width=5em] {$Y'$};
    \end{scope}

    \draw[->, postaction={decorate, decoration={text along path, text align={center},text={${\overrightarrow{R}}{\;}$}}}] (0,0) -- (3,2)  node[right, text width=5em] () {};

\end{tikzpicture}

\end{document}

회전_0

일단 내가 바꾸면

\begin{scope}[rotate=0,draw=red]

에게

\begin{scope}[rotate=20,draw=red]

나는 얻다: 회전_20

X'Y' 좌표계의 원점을 XY 좌표계의 (3,2) 위치에 어떻게 배치할 수 있습니까?

또한 $\overrightarrow{R}$를 조금 더 높게 배치하고 싶습니다. 벡터 위에 어떻게 배치할 수 있나요?

답변1

회전은 기본적으로 점 (0,0)을 사용합니다. 여기에서 20도 회전한 화살표 R인 주황색 화살표를 참조하세요.

여기에 이미지 설명을 입력하세요

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\begin{document}

\begin{tikzpicture}[thick]
    \draw[-latex] (0,0) -- (4,0)  node[right, text width=5em] {$X$};
    \draw[-latex] (0,0) -- (0,4)  node[right, text width=5em] {$Y$};

    \begin{scope}[rotate=20,draw=red]
        \draw[->] (3,2) -- (7,2)  node[right, text width=5em] {$X'$};
        \draw[->] (3,2) -- (3,6)  node[right, text width=5em] {$Y'$};
    \end{scope}
    \begin{scope}
      \draw[->,orange,rotate=20] (0,0)--(3,2);
    \end{scope}

    \draw[->, postaction={decorate, decoration={text along path, text align={center},text={${\overrightarrow{R}}{\;}$}}}] (0,0) -- (3,2)  node[right, text width=5em] () {};

\end{tikzpicture}

\end{document}

따라서 기본 지점(평가의 중심)을 변경해야 하며 다음 명령을 사용하여 이를 수행할 수 있습니다 rotate around.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text}

\begin{document}

\begin{tikzpicture}[thick]
    \draw[-latex] (0,0) -- (4,0)  node[right, text width=5em] {$X$};
    \draw[-latex] (0,0) -- (0,4)  node[right, text width=5em] {$Y$};

    \begin{scope}[rotate around={20:(3,2)},draw=red]
        \draw[->] (3,2) -- (7,2)  node[right, text width=5em] {$X'$};
        \draw[->] (3,2) -- (3,6)  node[right, text width=5em] {$Y'$};
    \end{scope}

    \draw[->, postaction={decorate, decoration={text along path, text align={center},text={${\overrightarrow{R}}{\;}$}}}] (0,0) -- (3,2)  node[right, text width=5em] () {};

\end{tikzpicture}

\end{document}

여기에 이미지 설명을 입력하세요

관련 정보