4

The diagram below look like a 3D diagram.

Would it be possible to draw in Latex? I know it is unpolite to ask this question, but I really no idea how to start it even I was given the tutorial for TikZ.

I only able to draw:

    \documentclass{article}
\usepackage{tikz}
\usepackage{subcaption}
\begin{document}

\begin{figure} \centering \captionsetup[subfigure]{skip=0pt} % to reduce space above subcaption \begin{tikzpicture}

\draw[step=1cm,gray,very thin] (-2,-2) grid (6,6);

\end{tikzpicture} \caption{stuff} \end{figure} \end{document}

enter image description here

aan
  • 2,663

1 Answers1

5

I think that the following code demonstrate all you need to complete your picture:

\documentclass[tikz, border = 0.5 cm]{standalone}
\usetikzlibrary{3d}
\begin{document}
 \begin{tikzpicture}[x={(1,-0.2)}, y={(0,0.8)}, z={(-0.5,-0.2)}] %adjust these numbers to get your preferred tilt and distance for everything
     \begin{scope}[canvas is zy plane at x=0]
        \fill[green!30] (5,5) rectangle (8,8);
        \draw [gray,very thin] (0,0) grid (8,8); 
        \draw[red,thick] (6,6) rectangle (7,7);
        \fill[green,transparent] (5,5) rectangle (8,8);
     \end{scope}
     \begin{scope}[canvas is zy plane at x=6]
        \fill[green!30] (5,5) rectangle (8,8);
        \draw [gray,very thin] (5,5) grid (8,8);
        \draw[red,thick] (6,6) rectangle (7,7);
    \end{scope}
    \begin{scope}[canvas is zy plane at x=10]
        \draw [gray,very thin] (0,0) grid (8,8); 
        \draw[red,thick] (6,6) rectangle (7,7);
    \end{scope}

\draw[blue,thick] (0,5,8) -- (10,5,8); \draw[blue,thick] (0,8,5) -- (10,8,5);

\node at (0,6.5,6.5) {6}; \node at (6,6.5,6.5) {0}; \node at (10,6.5,6.5) {-3}; \draw[->] (0,9,9)node[above] {Source pixel} -- (0,7,6.5); \end{tikzpicture} \end{document}

Three tilted grids with numbers

  • 1
    thanks. Brillant! I able to fill up the number in the box. However, any idea to add a label of each scope? For example just add in Panel 1, Panel 2, Panel 3. – aan Aug 11 '20 at 14:11
  • 1
    I do not understand what "label of each scope" means!? Do you want the text Panel 1 written above the left grid? Just do it the same way as the numbers. – hpekristiansen Aug 11 '20 at 14:45
  • 1
    @hperkristianse, thanks. sorry my mistake. Can i ask, how to make a acrow become ticker? – aan Aug 11 '20 at 15:06
  • 2
    Search for "tikz arrow heads" and "tikz line width". Example: \draw[-stealth,ultra thick] (0,9,9)node[above] {Source pixel} -- (0,7,6.5); – hpekristiansen Aug 11 '20 at 15:24
  • 1
    thanks. I had selected your answer. I have another questions again https://tex.stackexchange.com/questions/558349/unable-to-find-a-grids-colour-it – aan Aug 11 '20 at 22:43