立方体和 tikz 图片

立方体和 tikz 图片

我有一个包含一些立方体的图。但是有一些错误我无法解决,此外 1-如何为立方体添加颜色?2-如何将图形居中?3-如何将数字和标题附加到图形上?4-如何将箭头淹没在虚线中?

我在下面添加了我的命令:

\documentclass[reqno]{amsart}
\usepackage{subfigure}
\usepackage{amsfonts}
%\usepackage{xy}
\usepackage{newlfont}
\usepackage[centertags]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
%\usepackage{qsymbols}
\usepackage{graphicx}
\usepackage{plain}
\usepackage{mathrsfs}
\usepackage{makecell}
\usepackage{enumerate}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc}

 \setcounter{page}{1}
\renewcommand{\baselinestretch}{1.5}
\oddsidemargin=.25cm \evensidemargin=.25cm \textwidth=15cm
\topmargin=0cm \textheight=21cm
%\textwidth= \textheight=
\theoremstyle{definition}
\newtheorem{theorem}{Theorem.}[section]
\newtheorem{lemma}[theorem]{Lemma.}
\newtheorem{proposition}[theorem]{Proposition.}
\newtheorem{corollary}[theorem]{Corollary.}

 \newtheorem{definition}[theorem]{Definition.}
\newtheorem{example}[theorem]{Example.}
\newtheorem{remark}[theorem]{Remark.}
\begin{document}


\tdplotsetmaincoords{80}{125} %perspective angles

 \begin{tikzpicture}[t][tdplot_main_coords]

 \coordinate (o) at (0,0,0);

 %\draw[dshed] (o) -- (4,0,0);
%\draw[dshed] (o) -- (0,8,0);
%\draw[dshed] (o) -- (0,0,4);
%draw the top and the bottom of the cube
%\draw[fil1=blue!5] (o) -- (0,2,0) -- (2,2,0) -- (2,0,0) -- cycle;
%\draw[fil1=red!5] (o) -- (0,2,0) -- (0,2,2) -- (0,0,2) -- cycle;
%\draw[fil1=red!5] (o) -- (0,0,2) -- (2,0,2) -- (2,0,0) -- cycle;

 \draw[fil1=blue!5] (0,0,2) -- (0,2,2) -- (2,2,2) -- (2,0,2) -- cycle;
\draw[fil1=blue!5] (2,0,0) -- (2,0,2) -- (2,2,2) -- (2,2,0) -- cycle;
\draw[fil1=blue!5] (0,2,2) -- (0,2,0) -- (2,2,0) -- (2,2,2) -- cycle;
\node (A) at (0.68,0.68,1) {\Huge H};
\draw[very thick, ->] (2,1,1) -- node[midway,above]{$\dfrac{dN}{dt}$}(3.6,1,1);

 \draw[fil1=yellow!5] (4,2,2) -- (4,2,0) -- (6,2,0) -- (6,2,2) -- cycle;
\draw[fil1=yellow!5] (6,0,0) -- (6,0,2) -- (6,2,2) -- (6,2,0) -- cycle;
\draw[fil1=yellow!5] (6,0,2) -- (4,0,2) -- (4,2,2) -- (6,2,2) -- cycle;
\draw[very thick, ->] (6,1,1) -- node[midway,above]{$\dfrac{dR}{dt}$}(7.6,1,1);
\node (A) at (4.68,0.68,1) {\Huge N};

 \draw[fil1=red!5] (8,2,2) -- (8,2,0) -- (10,2,0) -- (10,2,2) -- cycle;
\draw[fil1=red!5] (10,0,0) -- (10,0,2) -- (10,2,2) -- (10,2,0) -- cycle;
\draw[fil1=red!5] (10,0,2) -- (8,0,2) -- (8,2,2) -- (10,2,2) -- cycle;
\node (A) at (8.68,0.68,1) {\Huge R};
\end{tikzpicture}



 \end{document}

谢谢

答案1

正如所愿,以下是我的评论,已转换为答案:

\documentclass[reqno]{amsart}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{calc}
%
\setcounter{page}{1}
\renewcommand{\baselinestretch}{1.5}
\oddsidemargin=.25cm \evensidemargin=.25cm \textwidth=15cm
\topmargin=0cm \textheight=21cm
%
\begin{document}
%
\tdplotsetmaincoords{80}{125} %perspective angles
%
\begin{figure}%
    \centering
    \begin{tikzpicture}[tdplot_main_coords]
        %
        \coordinate (o) at (0,0,0);
        %
        \draw[fill=blue!5] (0,0,2) -- (0,2,2) -- (2,2,2) -- (2,0,2) -- cycle;
        \draw[fill=blue!5] (2,0,0) -- (2,0,2) -- (2,2,2) -- (2,2,0) -- cycle;
        \draw[fill=blue!5] (0,2,2) -- (0,2,0) -- (2,2,0) -- (2,2,2) -- cycle;
        \node (A) at (0.68,0.68,1) {\Huge H};
        \draw[very thick, dotted, ->] (2,1,1) -- node[midway,above]{$\dfrac{dN}{dt}$}(3.6,1,1);
        %
        \draw[fill=yellow!5] (4,2,2) -- (4,2,0) -- (6,2,0) -- (6,2,2) -- cycle;
        \draw[fill=yellow!5] (6,0,0) -- (6,0,2) -- (6,2,2) -- (6,2,0) -- cycle;
        \draw[fill=yellow!5] (6,0,2) -- (4,0,2) -- (4,2,2) -- (6,2,2) -- cycle;
        \draw[very thick, dotted, ->] (6,1,1) -- node[midway,above]{$\dfrac{dR}{dt}$}(7.6,1,1);
        \node (A) at (4.68,0.68,1) {\Huge N};
        %
        \draw[fill=red!5] (8,2,2) -- (8,2,0) -- (10,2,0) -- (10,2,2) -- cycle;
        \draw[fill=red!5] (10,0,0) -- (10,0,2) -- (10,2,2) -- (10,2,0) -- cycle;
        \draw[fill=red!5] (10,0,2) -- (8,0,2) -- (8,2,2) -- (10,2,2) -- cycle;
        \node (A) at (8.68,0.68,1) {\Huge R};
    \end{tikzpicture}
\caption{Some caption}%
\label{label}%
\end{figure}
%
\end{document}

在此处输入图片描述

相关内容