我想知道如何绘制两个坐标轴

我想知道如何绘制两个坐标轴

enter image description here

这是我目前拥有的框架的代码

\begin{tikzpicture}
[scale=3,
    tdplot_main_coords,
    axis/.style={->,black,thick},
    vector/.style={-stealth,red,very thick}]

%standard tikz coordinate definition using x, y, z coords
\coordinate (O) at (0,0,0);

%tikz-3dplot coordinate definition using r, theta, phi coords
\tdplotsetcoord{P}{.8}{55}{60}

%draw axes
\draw[axis] (0,0,0) -- (1,0,0) node[anchor=north east]{$y$};
\draw[axis] (0,0,0) -- (0,1,0) node[anchor=north west]{$z$};
\draw[axis] (0,0,0) -- (0,0,1) node[anchor=south]{$x$};
\end{tikzpicture}

\begin{tikzpicture}
[scale=3,
    tdplot_main_coords,
    axis/.style={->,black,thick},
    vector/.style={-stealth,red,very thick},
    vector guide/.style={dashed,red,thick}]

%standard tikz coordinate definition using x, y, z coords
\coordinate (O) at (0,0,0);

%tikz-3dplot coordinate definition using r, theta, phi coords
\tdplotsetcoord{P}{.8}{55}{60}

%draw axes
\draw[axis] (0,0,0) -- (1,0,0) node[anchor=north east]{$y'$};
\draw[axis] (0,0,0) -- (0,1,0) node[anchor=north west]{$z'$};
\draw[axis] (0,0,0) -- (0,0,1) node[anchor=south]{$x'$};
\end{tikzpicture}

答案1

这是一种可能性。将两个坐标系放在同一个 中tikzpicture,对于第二个坐标系,使用相对坐标绘制它(+(x,y,z)而不是(x,y,z),表示它相对于前一个坐标)。因此,要移动第二个坐标系,只需更改 的坐标即可O2

要在O2系统中绘制事物,您可以使用与系统相同的坐标O,并添加shift=(O2)路径选项,就像我在下面所做的那样\draw[vector,shift=(O2)] (0,0.5,0) -- (0,0.5,0.7) node[left,black] {velocity $\mathbf{v}$};

enter image description here

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
[scale=3,
    axis/.style={->,black,thick},
    vector/.style={-stealth,red,very thick},
    vector guide/.style={dashed,red,thick}]

%standard tikz coordinate definition using x, y, z coords
\coordinate (O) at (0,0,0);

%draw axes
\draw[axis] (O) -- (1,0,0) node[anchor=north east]{$y$};
\draw[axis] (O) -- (0,1,0) node[anchor=north west]{$z$};
\draw[axis] (O) -- (0,0,1) node[right]{$x$};

% modify this for position of second system
\coordinate (O2) at (-0.05,0,0.7);

%draw axes with relative coordinates
\draw[axis] (O2) -- +(1,0,0) node[anchor=north east]{$y'$};
\draw[axis] (O2) -- +(0,1,0) node[anchor=north west]{$z'$};
\draw[axis] (O2) -- +(0,0,1) node[above]{$x'$};

\draw[vector,shift=(O2)] (0,0.5,0) -- (0,0.5,0.7) node[left,black] {velocity $\mathbf{v}$};
\end{tikzpicture}
\end{document}

相关内容