Cómo rotar el eje correctamente usando tikzpicture

Cómo rotar el eje correctamente usando tikzpicture

Tengo dos marcos de coordenadas que tienen un desplazamiento y una rotación entre ellos.

Usando el siguiente ejemplo intenté visualizarlo:

\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}

rotar_0

una vez que cambio

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

a

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

Yo obtengo: rotar_20

¿Cómo podría colocar el origen de mi marco de coordenadas X'Y' en la posición (3,2) en mi sistema de coordenadas XY?

Además, me gustaría colocar $\overrightarrow{R}$ un poco más arriba. ¿Cómo podría colocarlo encima del vector?

Respuesta1

Rotar, está usando por defecto el punto (0,0): Vea aquí la flecha naranja que es la flecha R rotada 20 grados:

ingrese la descripción de la imagen aquí

\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}

Entonces tienes que cambiar el punto predeterminado (el centro de la relación) y esto se puede hacer con el comando: rotate aroundcomo:

\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}

ingrese la descripción de la imagen aquí

información relacionada