0
  1. I want to scale the second line of this tikzpicture to be smaller than the first row.

  2. I want to label the Tikzpicture just as the question Stacking 3D Cubes with Spacing

...

\documentclass[10pt, xcolor = {dvipsnames}]{beamer}

\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}
        \begin{scope}[local bounding box=first row]
        
            \begin{scope}[local bounding box =vector]
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            \end{scope}
        
        
            \begin{scope}[xshift=4cm, local bounding box = matrix]
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;        
            \end{scope}
        
        
            \begin{scope}[xshift=8cm, local bounding box = matrix]
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            \end{scope}
        
        \end{scope}
    
        \begin{scope}[yshift=-5.5cm,local bounding box=data frame]
        
            \begin{scope}[local bounding box =vector]
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
            \end{scope}
        
            \begin{scope}[xshift=3cm, local bounding box =vector]
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            \end{scope}
        
        
            \begin{scope}[xshift=5cm, local bounding box = matrix]
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;        
            \end{scope}
        
        
            \begin{scope}[xshift=9cm, local bounding box = matrix]
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,1.1,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (0,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (1.1,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
                \draw[white, fill = Cyan] (2.2,2.2,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            \end{scope}
        
        \end{scope}
    \end{tikzpicture}
\end{document}

What I Have Here is the what I have

What I Want

Here is a similar thing that I want

Edit

Edit for whatever changes you want on my code. Do not write a different code please.

1 Answer 1

2

1. Question

You divided your tikzpicture into several scope environments. To make the second line smaller than the first one, you just have to insert scale=<factor> in the corresponding scope. The factor should be a floating point number between 0 and 1 if you want shrink this line. So change this line:

\begin{scope}[yshift=-5.5cm,local bounding box=data frame]

for example in the following

\begin{scope}[yshift=-5.5cm,local bounding box=data frame, scale=.5]

2. Question

To add labels, you can for example place nodes in the appropriate places in the image. Here is an example for the vector in the first line. Change this:

\begin{scope}[local bounding box =vector]
  \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
  \draw[white, fill = Cyan] (0,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
  \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
  \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
  \draw[white, fill = Cyan] (1.1,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
  \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
  \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
  \draw[white, fill = Cyan] (2.2,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
  \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
\end{scope}

in this

\begin{scope}[local bounding box =vector]
  \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
  \draw[white, fill = Cyan] (0,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
  \draw[white, fill = Cyan] (0,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
  \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
  \draw[white, fill = Cyan] (1.1,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
  \draw[white, fill = Cyan] (1.1,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
            
  \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
  \draw[white, fill = Cyan] (2.2,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
  \draw[white, fill = Cyan] (2.2,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;

  \node at (1,.75) {vector};% <-- added
\end{scope}

Do the same for the other labels.


Additional tips to improve your code

Your picture consists of many cubes arranged in different ways. If want to repeat the same thing several times, you can use a loop. TikZ offers the foreach loop. Here is short example to draw the vector in the first line.

\begin{scope}[local bounding box =vector]
  \foreach \x in {0, 1.1, 2.2} {
    \draw[white, fill = Cyan] (\x,0,0) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
    \draw[white, fill = Cyan] (\x,0,0) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
    \draw[white, fill = Cyan] (\x,0,0) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
  }
\end{scope}

If you want to read/learn more about the foreach loop, take a look at the PGF/TikZ manual (section 88 Repeating Things: The Foreach Statement). I also recommend to learn how you can use the same style for all your cubes (see cubeStyle in my optimized version).


Optimized version

\documentclass[10pt, dvipsnames]{standalone}

\usepackage{tikz}
\usepackage{xifthen}

\newcommand\drawCube[3]{%
    \draw[cubeStyle] (#1,#2,#3) -- ++(-1,0,0) -- ++(0,-1,0) -- ++(1,0,0) -- cycle;
    \draw[cubeStyle] (#1,#2,#3) -- ++(0,0,-1) -- ++(0,-1,0) -- ++(0,0,1) -- cycle;
    \draw[cubeStyle] (#1,#2,#3) -- ++(-1,0,0) -- ++(0,0,-1) -- ++(1,0,0) -- cycle;
}

\begin{document}
    \begin{tikzpicture}[
        cubeStyle/.style={
            white,
            fill=Cyan
        },
        arrowStyle/.style={
            ->,
            thick
        }
    ]
        \begin{scope}[local bounding box=first row]
            \foreach \xshift/\name [count=\c] in {0/Vector, 5/Matrix,11/Array} {%
                \begin{scope}[xshift=\xshift cm, local bounding box = \name]
                    % labels above and pins of the matrix
                    \ifthenelse{\c = 1} {
                        \node at (1,.75) {\name};
                    }{
                        \ifthenelse{\c = 2} {
                            \node at (1,3) {\name};
                            \node at (.6,-2.3) (columnsPin) {columns};
                            \draw (columnsPin)
                                edge[arrowStyle] (-0.5, -1.15)
                                edge[arrowStyle] ( 0.6, -1.15)
                                edge[arrowStyle] ( 1.7, -1.15);
                            \node at (4.3,1.1,.55) (rowsPin) {rows};
                            \draw (rowsPin)
                                edge[arrowStyle] (3,2.2,.55)
                                edge[arrowStyle] (3,1.1,.55)
                                edge[arrowStyle] (3,0,.55);
                        }{
                            \node at (4.25,6.25,6.25) {\name};
                        }
                    }

                    % draw vector, matrix or array
                    \foreach \x in {0,1.1,2.2} {%
                        \ifthenelse{\c = 1} {
                            \drawCube{\x}{0}{0}
                        }{
                            \foreach \y in {0,1.1,2.2} {%
                                \ifthenelse{\c = 2} {
                                    \drawCube{\x}{\y}{0}
                                }{
                                    \foreach \z in {2.2,1.1,0} {%
                                        \drawCube{\x}{\y}{-\z}
                                    }
                                }
                            }
                        }
                    }
                \end{scope}
            }
        \end{scope}
    
        \begin{scope}[yshift=-5cm, xshift=7cm, local bounding box=second row, scale=.55]% added scale=.5 to make the second row smaller than the first row
            \begin{scope}[local bounding box =vector]
                \foreach \x in {0,1.1} {%
                    \drawCube{\x}{0}{0}
                }
            \end{scope}
        
            \begin{scope}[xshift=3cm, local bounding box =vector]
                \foreach \y in {0,1.1,2.2} {%
                    \drawCube{0}{\y}{0}
                }
            \end{scope}

            \foreach \xshift/\name [count=\c] in {5/matrix,9/array} {%
                \begin{scope}[xshift=\xshift cm, local bounding box = \name]
                    \foreach \x in {0,1.1,2.2} {%
                        \foreach \y in {0,1.1,2.2} {%
                            \ifthenelse{\c = 1}{
                                \drawCube{\x}{\y}{0}
                            }{
                                \foreach \z in {2.2,1.1,0} {%
                                    \drawCube{\x}{\y}{-\z}
                                }
                            }
                        }
                    }
                \end{scope}
            }
        \end{scope}
    \end{tikzpicture}
\end{document}

Result

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .