\begin{tikzpicture}[node distance=2.5cm]
\node (a) at (0,0) {27\ 9\ 3};
\node [below right of=a] (b) {27\ $3^4$};
\node [below left of=a] (c) {$9^43$};
\node [below of=a] (d) {$27\ 9\ 1^3$};
\node [below of=c] (e) {$9^4\ 1^3$};
\node [below right of=c] (f) {$9^3\ 3^4$};
\node [below of=b] (g) {$27\ 3^3\ 1^3$};
\node [below of=d] (h) {$9^3\ 3^3\ 1^3$};
\draw[thick, black] (a)--(b);
\draw[thick, black] (a)--(c);
\draw[thick, black] (a)--(d);
\draw[thick, black] (c)--(e);
\draw[thick, black] (c)--(f);
\draw[thick, black] (b)--(f);
\draw[thick, black] (b)--(g);
\draw[thick, black] (e)--(h);
\draw[thick, black] (f)--(h);
\draw[thick, black] (g)--(h);
\draw[thick, black] (d)--(e);
\draw[thick, black] (d)--(g);
\end{tikzpicture}
答案1
欢迎!您可以直接在三维空间中绘制立方体并使用适当的正交投影。等距视图接近“等长”的描述,但在这种情况下并没有真正产生良好的结果。所以我会使用避免重叠节点的通用投影。3D 中角之间的距离仍然相同,但屏幕上的投影不同。
\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{perspective}
\begin{document}
\begin{tikzpicture}[scale=2,
pics/Numbered Cube/.style={code={
\path (1,1,1) node (a) {$27\ 9\ 3$}
(1,-1,1) node (b) {$27\ 3^4$}
(-1,-1,1) node (c) {$9^3\ 3^4$}
(-1,1,1) node (d) {$9^43$}
(1,1,-1) node (e) {$27\ 9\ 1^3$}
(1,-1,-1) node (f) {$27\ 3^3\ 1^3$}
(-1,-1,-1) node (g) {$9^3\ 3^3\ 1^3$}
(-1,1,-1) node (h) {$9^4\ 1^3$};
\draw[thick]
(a) edge (e) -- (b) edge (f) -- (c) edge (g) -- (d) edge (h) -- (a)
(e) -- (f) -- (g) -- (h) -- (e);
}}]
\begin{scope}[isometric view,local bounding box=view 1]
\pic{Numbered Cube};
\end{scope}
\begin{scope}[xshift=2.5cm,3d view={-45}{20},local bounding box=view 2]
\pic{Numbered Cube};
\end{scope}
\begin{scope}[xshift=5cm,3d view={-25}{20},local bounding box=view 3]
\pic{Numbered Cube};
\end{scope}
\path ([yshift=-1ex]current bounding box.south) coordinate (aux);
\path[font=\sffamily]
(view 1.south|-aux) node[below] {isometric view}
(view 2.south|-aux) node[below] {tilted isometric view}
(view 3.south|-aux) node[below] {generic view};
\end{tikzpicture}
\end{document}
答案2
和tikz-cd
:
\documentclass[margin=3mm]{standalone}
\usepackage{tikz-cd}
\begin{document}
\begin{tikzcd}[
every arrow/.append style={dash},
column sep=0em,
row sep=1em ,
]
% diagram
& 27\,9\,3 \ar[rr]\ar[dd] \ar[dl]
& & 27\,3^4 \ar[dd]\ar[ld] \\
9^4\,3 \ar[rr,crossing over]\ar[dd]
& & 9^3\,3^4 & \\
& 27\,9\,1^3 \ar[rr]
& & 27\,3^3\,1^3 \\
9^4\,1^3 \ar[ur]\ar[rr]
& & 9^3\,3^3\,1^3\ar[uu,crossing over] \ar[ur]
& \\
\end{tikzcd}%
\end{document}