我怎样才能绘制这个图表

我怎样才能绘制这个图表

我正在尝试绘制以下图片,但遇到了一些困难。几周前我才开始学习 LaTeX。我编写了以下代码:

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\pgfmathsetmacro{\cubex}{2}
\pgfmathsetmacro{\cubey}{2}
\pgfmathsetmacro{\cubez}{2}
\draw[red] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,-\cubey,0) -- ++(\cubex,0,0) -- cycle;
\draw[red] (0,0,0) -- ++(0,0,-\cubez) -- ++(0,-\cubey,0) -- ++(0,0,\cubez) -- cycle;
\draw[red] (0,0,0) -- ++(-\cubex,0,0) -- ++(0,0,-\cubez) -- ++(\cubex,0,0) -- cycle;
\end{tikzpicture}
\end{document}

非常感谢。

答案1

你可以从

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}
\begin{tikzpicture}[z={(3.85mm, -3.85mm)}]


%\draw (0,0,0) -- (1,0,0) node {x};
%\draw (0,0,0) -- (0,1,0) node {y};
%\draw (0,0,0) -- (0,0,1) node {z};

\pgfmathsetmacro{\cubex}{2}
\pgfmathsetmacro{\cubey}{2}
\pgfmathsetmacro{\cubez}{2}
\foreach \x/\j in {0/red,2/green,3/purple,4/orange,5/brown,7/red} 
\draw[\j] (\x,0,0) -- ++(0,\cubey,0) -- ++(0,0,\cubez) -- ++(0,-\cubey,0) -- cycle;

\foreach \i in {(0,0,0),(0,\cubey,0), (0,0,\cubez), (0,\cubey,\cubez)}
\draw[red] \i -- ++(7,0,0);

\draw[decorate, decoration={brace, raise=5pt}] (2,\cubey,0) -- (5,\cubey,0) node[midway,above=3mm]{A};
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容