I've tried to draw a cube made by cubes on each side with TikZ. I mean a 3x3 cube with a little shift between each one. I've looked for an answer but the first hard step is starting with a good way to draw a cube. Then a need to put them on the edges of the 3x3 big cube. Basically, I just want to show three faces of our cube such that looks something like this: 
But my pretty sad code to show it is this:
\documentclass{minimal}
\usepackage{tikz}
% Three counters
\newcounter{x}
\newcounter{y}
\newcounter{z}
% The angles of x,y,z-axes
\newcommand\xaxis{210}
\newcommand\yaxis{-30}
\newcommand\zaxis{90}
% The top side of a cube
\newcommand\topside[3]{
\fill[fill=red!50, draw=black,shift={(\xaxis:#1)},shift={(\yaxis:#2)},
shift={(\zaxis:#3)}] (0,0) -- (30:1) -- (0,1) --(150:1)--(0,0);
}
% The left side of a cube
\newcommand\leftside[3]{
\fill[fill=red, draw=black,shift={(\xaxis:#1)},shift={(\yaxis:#2)},
shift={(\zaxis:#3)}] (0,0) -- (0,-1) -- (210:1) --(150:1)--(0,0);
}
% The right side of a cube
\newcommand\rightside[3]{
\fill[fill=red!50!black, draw=black,shift={(\xaxis:#1)},shift={(\yaxis:#2)}, shift={(\zaxis:#3)}] (0,0) -- (30:1) -- (-30:1) --(0,-1)--(0,0);}
% The cube
\newcommand\cube[3]{
\topside{#1}{#2}{#3} \leftside{#1}{#2}{#3} \rightside{#1}{#2}{#3} }
% Definition of \planepartition
% To draw the following plane partition, just write \planepartition{ {a, b,c}, {d,e} }.
% a b c
% d e
\newcommand\planepartition[1]{
\setcounter{x}{-1}
\foreach \a in {#1} {
\addtocounter{x}{1}
\setcounter{y}{-1}
\foreach \b in \a {
\addtocounter{y}{1}
\setcounter{z}{-1}
\foreach \c in {1,...,\b} {
\addtocounter{z}{1}
\cube{\value{x}}{\value{y}}{\value{z}}
}
}
}
}
\begin{document}
\begin{tikzpicture}
\planepartition{{1}}
\begin{scope}[yshift=1.5cm,xshift=0cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=5cm,xshift=3cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=4cm,xshift=1.5cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=0cm,xshift=6cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=-1cm,xshift=4.5cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=1.5cm,xshift=6cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=4cm,xshift=4.5cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=3cm,xshift=6cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=2cm,xshift=4.5cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=3cm,xshift=0cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=2cm,xshift=1.5cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=-1cm,xshift=1.5cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=-2cm,xshift=3cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=-.5cm,xshift=3cm]
\planepartition{{1}}
\end{scope}
\begin{scope}[yshift=1cm,xshift=3cm]
\planepartition{{1}}
\end{scope}
\end{tikzpicture}
\end{document}
If you can see, I have a little trouble to align my cubes. So
- How Can I align my cubes?
- Is there an easier way to draw it?
- How can i create an efficient code to draw it?
I´m not care about another perspective of the cube or another faces.
minimalfor examples. It is not suitable. – cfr Aug 22 '16 at 23:43