在三维坐标系上绘制矢量?

在三维坐标系上绘制矢量?

我对tikzLaTeX 还不熟悉,所以如果这个问题问得有点傻,请见谅。我想复制这个:

莉娜

到目前为止,我有以下内容。

\begin{tikzpicture}[x=1cm, y=1cm, z=-0.6cm]
    % Axes
    \draw [->] (0,0,0) -- (4,0,0) node [at end, right] {$x$};
    \draw [->] (0,0,0) -- (0,4,0) node [at end, left] {$y$};
    \draw [->] (0,0,0) -- (0,0,4) node [at end, left] {$z$};

    % Vectors
    \draw [->, thick] (0,0,0) -- (0,2,1);
    \draw [->, thick] (0,0,0) -- (2,2,0);

    \draw [loosely dashed] (0,0,1) -- (0,2,1);
    \draw [loosely dashed] (0,2,0) -- (0,2,1);
    \draw [loosely dashed] (2,0,0) -- (2,2,0);
    \draw [loosely dashed] (0,2,0) -- (2,2,0);

    % Labels
    \node [left] at (0,2,1) {$\begin{bmatrix}
                               0\\2\\1
                              \end{bmatrix}$};
    \node [right] at (2,2,0) {$\begin{bmatrix}
                                2\\2\\0
                               \end{bmatrix}$};

\end{tikzpicture}

在此处输入图片描述

它缺少轴刻度,轴的方向与图片不同(虽然我猜从数学上讲这不会造成太大的差异)。我一直在阅读手册pgf并浏览论坛,但我仍然困惑不已!

答案1

纯溶液tikz

\documentclass[tikz, margin=3mm]{standalone}
\usepackage{amsmath}

\begin{document}
\begin{tikzpicture}[x=1cm, y=1cm, z=-0.6cm]
    % Axes
    \draw [->] (0,0,0) -- (4,0,0) node [right] {$x$};
    \draw [->] (0,0,0) -- (0,4,0) node [left] {$y$};
    \draw [->] (0,0,0) -- (0,0,4) node [left] {$z$};
    % Vectors
    \draw [->, thick] (0,0,0) -- (2,2,0);
    \draw [->, thick] (0,0,0) -- (2,0,1);
    % Ticks
        \foreach \i in {1,2}
    {
    \draw (-0.1,\i,0) -- ++ (0.2,0,0);
    \draw (\i,-0.1,0) -- ++ (0,0.2,0);
    \draw (-0.1,0,\i) -- ++ (0.2,0,0);
    }
    % Dashed lines
    \draw [loosely dashed]
        (0,2,0) -- (2,2,0) -- (2,0,0)
        (0,0,1) -- (2,0,1) -- (2,0,0)
        ;
    % Labels
     \node [right] at (2,2,0) {$\begin{bmatrix}
                                2\\2\\0
                               \end{bmatrix}$};
   \node [below] at (2,0,1) {$\begin{bmatrix}
                               2\\0\\1
                              \end{bmatrix}$};

\end{tikzpicture}
\end{document}

给出:

在此处输入图片描述

附录:使用包的解决方案tikz-3dplot

\documentclass[tikz, margin=3mm]{standalone}
\usepackage{tikz-3dplot}
\usepackage{amsmath}

\begin{document}
\tdplotsetmaincoords{60}{120}
\begin{tikzpicture}[tdplot_main_coords]
% Axes
\draw [->] (0,0,0) -- (3,0,0) node [below left] {$x$};
\draw [->] (0,0,0) -- (0,3,0) node [right] {$y$};
\draw [->] (0,0,0) -- (0,0,3) node [above] {$z$};
% Vectors
\draw [->, thick] (0,0,0) -- (2,2,0);
\draw [->, thick] (0,0,0) -- (2,0,1);
% Ticks
    \foreach \i in {1,2}
{
\draw (-0.1,\i,0) -- ++ (0.2,0,0);
\draw (\i,-0.1,0) -- ++ (0,0.2,0);
\draw (-0.1,0,\i) -- ++ (0.2,0,0);
}
% Dashed lines
\draw [loosely dashed]
    (0,2,0) -- (2,2,0) -- (2,0,0)
    (0,0,1) -- (2,0,1) -- (2,0,0)
    ;
% Labels
 \node [below right] at (2,2,0) {$\begin{bmatrix}
                                    2\\2\\0
                                \end{bmatrix}$};
 \node [above  left] at (2,0,1) {$\begin{bmatrix}
                                    2\\0\\1
                                \end{bmatrix}$};
\end{tikzpicture}
\end{document}

这使:

在此处输入图片描述

我不太熟悉,tikz-3dpackage所以对于 3d 空间的其他投影,你需要提出新的问题。

相关内容