% !Mode:: “TeX:UTF-8”%確保文檔utf-8編碼
\documentclass[tikz,border=2pt]{standalone}
\begin{document}
\begin{tikzpicture}
%draw the axes
\draw[->] (0,0,0) — (3,0,0) node[anchor=west]{$x$};
\draw[->] (0,0,0) — (0,3,0) node[anchor=west]{$y$};
\draw[->] (0,0,0) — (0,0,3) node[anchor=west]{$z$};
%draw the top and bottom of the cube
\draw (0,0,0) — (0,2,0) — (2,2,0) — (2,0,0) — cycle;
\draw[] (0,0,2) — (0,2,2) — (2,2,2) — (2,0,2) — cycle;
%draw the edges of the cube
\draw[] (0,0,0) — (0,0,2);
\draw[] (0,2,0) — (0,2,2);
\draw[] (2,0,0) — (2,0,2);
\draw (2,2,0) — (2,2,2);
\end{tikzpicture}
\end{tikzpicture}
\end{document}