# How to draw 3-cube Gray code?

If reflected gray codes are generated inductively then one can use two copies of 2-cubes to generate a 3-cube. This is what I am trying to illustrate. So I drew two copies of 2-cubes, but when I connect them with a straight line, I get a rather poor picture. I have attached the image and the latex code that I am using.

 \documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[scale=3]
\node (a) at (0,0,0) {$0000$};

\node (b) at (1,0,0) {$0001$};
\node (c) at (1,1,0) {$0101$};
\node (d) at (0,1,0) {$0100$};

\node (e) at (0,0,1) {$0010$};
\node (f) at (1,0,1) {$0011$};
\node (g) at (1,1,1) {$0111$};
\node (h) at (0,1,1) {$0110$};
----------
\node (a1) at (4,4,3) {$1000$};

\node (b1) at (5,4,3) {$1001$};
\node (c1) at (5,5,3) {$1101$};
\node (d1) at (4,5,3) {$1100$};

\node (e1) at (4,4,4) {$1010$};
\node (f1) at (5,4,4) {$1011$};
\node (g1) at (5,5,4) {$1111$};
\node (h1) at (4,5,4) {$1110$};

\draw (a) -- (b) -- (c) -- (d) -- (a);
\draw (e) -- (f) -- (g) -- (h) -- (e);
\draw(a) -- (e);
\draw (d) -- (h);
\draw (b) -- (f);
\draw (c) -- (g);

\draw (a1) -- (b1) -- (c1) -- (d1) -- (a1);
\draw (e1) -- (f1) -- (g1) -- (h1) -- (e1);
\draw(a1) -- (e1);
\draw (d1) -- (h1);
\draw (b1) -- (f1);
\draw (c1) -- (g1);

\draw (a) -- (a1);
\draw (b) -- (b1);
\draw (c) -- (c1);
\draw (d) -- (d1);
\draw (e) -- (e1);
\draw (f) -- (f1);
\draw (g) -- (g1);
\draw (h) -- (h1);

\end{tikzpicture}
\end{document}


Image:

The connections between various nodes are not clear in this image. What can I do to make this illustration better?

• What do you mean with not clear? A raster image can never be fully clear at all levels. – TeXnician Apr 20 '17 at 8:30
• Check out this example – marsupilam Apr 20 '17 at 8:34
• I'd just move the top cube down a bit so the connecting lines were not forming a diagonal of the first face – David Carlisle Apr 20 '17 at 8:37
• Also plenty of hypercubes in this question. – marsupilam Apr 20 '17 at 8:39