7

I want to draw a diagram like the attached picture, which actually describes a multidimensional array. Sample Multidimensional array

This is the code that I have:

\documentclass[11pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[x={(0.866cm,-0.5cm)}, y={(0.866cm,0.5cm)}, z={(0cm,1cm)}, scale=1.0,
    %Option for nice arrows
    >=stealth, %
    inner sep=0pt, outer sep=2pt,%
    axis/.style={thick,->},
    wave/.style={thick,color=#1,smooth},
    polaroid/.style={fill=black!60!white, opacity=0.3},
]
    % Colors
    \colorlet{darkgreen}{green!50!black}
    \colorlet{lightgreen}{green!80!black}
    \colorlet{darkred}{red!50!black}
    \colorlet{lightred}{red!80!black}

    % Frame
    \coordinate (O) at (0, 0, 0);


    \filldraw[polaroid] (0,-2,-1.5) -- (0,-2,1.5) -- (0,2,1.5) -- (0,2,-1.5) -- (0,-2,-1.5)
        node[below, sloped, near end]{Polaroid};%

            \draw[polaroid]   (12, -2,  -1.5) -- (12, -2,   1.5)  %Polarizing filter
        node [above, sloped,midway] {Polaroid} -- (12, 2, 1.5) -- (12, 2, -1.5) -- cycle;

       \end{tikzpicture}
\end{document}     

However, the output from the code is far away than the diagram that I need. I have one sample image from which I got the inspiration. enter image description hereAny help is highly appreciated.

15

Something like this maybe?

\documentclass[tikz,border=5]{standalone}
\begin{document} 
\begin{tikzpicture}[x=(15:.5cm), y=(90:.5cm), z=(330:.5cm), >=stealth]
\draw (0, 0, 0) -- (0, 0, 10) (4, 0, 0) -- (4, 0, 10);
\foreach \z in {0, 5, 10} \foreach \x in {0,...,3}
  \foreach \y [evaluate={\b=random(0, 1);}] in {0,...,3}
    \filldraw [fill=white] (\x, \y, \z) -- (\x+1, \y, \z) -- (\x+1, \y+1, \z) --
      (\x, \y+1, \z) -- cycle (\x+.5, \y+.5, \z) node [yslant=tan(15)] {\b};
\draw [dashed] (0, 4, 0) -- (0, 4, 10) (4, 4, 0) -- (4, 4, 10);
\draw [->] (0, 4.5, 0)  -- (4, 4.5, 0)   node [near end, above left] {Column};
\draw [->] (-.5, 4, 0)  -- (-.5, 0, 0)   node [midway, left] {Row};
\draw [->] (4, 4.5, 10) -- (4, 4.5, 2.5) node [near end, above right] {Channel};
\end{tikzpicture}%
\end{document}

enter image description here

7

This is what I came up with:

\documentclass{article}
\usepackage{tikz}
    \usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}[x=0.5cm,y=0.5cm]
    \begin{scope}[rotate=130,]
        \draw[gray] (-4  ,-1.5) -- (6  ,3.5);
    \end{scope}
    \foreach \shift in {-5,0,5}
    {
        \foreach \x in {1,...,4}
        {
            \foreach \y in {1,...,4}
            {
                \begin{scope}[rotate=130,shift={(\shift,0.5*\shift)},]
                    \draw[fill=white] (\x,\y) rectangle (\x+1,\y+1);
                    \node at (\x+0.5,\y+0.5) {\pgfmathrnd\pgfmathparse{round(\pgfmathresult)}
                        \pgfmathprintnumber[precision=1]{\pgfmathresult}};
                \end{scope}
            }
        }
    }
    \begin{scope}[rotate=130,]
        \draw         (-4, 2.5) -- (6  ,7.5);
        \draw[dashed] (0 , 2.5) -- (10,7.5);
        \draw[dashed] (0 ,-1.5) -- (10,3.5) node[midway,anchor=south west] {Channel};
    \end{scope}
\end{tikzpicture}
\end{document}

The single entries in your array are randomly generated, I did this, so that I don't have to type every entry by myself. This is what the result looks like Array

I hope the rest is pretty clear :)

  • thank u so much for your reply. I have added a sample figure in the question. Actually I want the viewing angle like the sample figure. Can u plz suggest how can I do that? thanks – jhon_wick Feb 20 '16 at 22:10
  • just play a bit around with the rotations and the possible values for the \shift. When I started I had no idea which values will look good, so I also had to randmly choose some until I found this configuration, which I find quite pleasing :) – manthano Feb 20 '16 at 22:13
  • Excellent attempt @manthano. However numbers on plan are not properly aligned. – MYaseen208 Feb 21 '16 at 13:21
  • @MYaseen208 What exactly do you mean? – manthano Feb 21 '16 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.