绘制简单的三维轴

绘制简单的三维轴

在此处输入图片描述

如何使用这样的组件绘制 3d 轴。

答案1

作为起点,可以使用以下代码:

\documentclass[border=2pt]{standalone}

% Drawing
\usepackage{tikz} 
\usepackage{tikz-3dplot}

\begin{document}
\tdplotsetmaincoords{60}{120}
\begin{tikzpicture}
    [scale=3,
        tdplot_main_coords,
        axis/.style={->,blue,thick},
        vector/.style={-stealth,red,very thick},
        dot/.style = {circle, fill, minimum size=#1,
              inner sep=0pt, outer sep=0pt},
        dot/.default = 6pt,>=latex]

    %standard tikz coordinate definition using x, y, z coords
    \coordinate (E) at (3,0,0);
    \coordinate (D) at (3,0,1);
    \coordinate (A) at (0,0,1);
    \coordinate (B) at (0,3,1);
    \coordinate (G) at (0,3,0);
    \coordinate (F) at (3,3,0);
    \coordinate (C) at (3,3,1);

    %draw axes
    \draw[axis] (0,0,0) -- (4,0,0) node[anchor=north east]{$x$};
    \draw[axis] (0,0,0) -- (0,4,0) node[anchor=north west]{$y$};
    \draw[axis] (0,0,0) -- (0,0,2) node[anchor=south]{$z$};
    \draw [thick](E)--(D)--(A)--(B)--(G)--(F)--cycle;
    \draw (D)--(C)--(B);
    \draw (C)--(F);
    
    %draw dots and labels
    \foreach \L in {A,B,C,D,E,F,G}{
    \node[dot,label=left:$\L$] at (\L) {};}
    \node at (C)[right] {$(3,3,1)$};
    
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容