Skip to content

Instantly share code, notes, and snippets.

@maifeeulasad
Created October 12, 2019 18:33
Show Gist options
  • Save maifeeulasad/953bb85e2a9b784b1353ed920502f760 to your computer and use it in GitHub Desktop.
Save maifeeulasad/953bb85e2a9b784b1353ed920502f760 to your computer and use it in GitHub Desktop.
Create matrix projection like view
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{backgrounds}
\begin{document}
\tdplotsetmaincoords{65}{60}
\begin{tikzpicture}[tdplot_main_coords]
\begin{scope}[canvas is xz plane at y=2,transform shape]
\node[inner xsep=-3pt,inner ysep=-0.3pt] (mat1){$\displaystyle
\begin{bmatrix}
3 & 9 \\
6 & 4 \\
\end{bmatrix}$};
\end{scope}
%
\begin{scope}[canvas is xz plane at y=0,transform shape]
\node[inner xsep=-4pt,inner ysep=-0.3pt] (mat2){$\displaystyle
\begin{bmatrix}
3 & 6 & 2 & 1 \\
2 & 1 & 9 & 6 \\
0 & 3 & 0 & 1 \\
6 & 5 & 2 & 4 \\
\end{bmatrix}$};
\end{scope}
%
\begin{scope}[on background layer]
\foreach \Y in {south,north} {\foreach \X in {west,east}
{\draw (mat1.\Y\space\X) -- (mat2.\Y\space\X);}}
\foreach \X in {1,2}
{\fill[blue!20] (mat\X.west) -- (mat\X.east) -- (mat\X.south east)
-- (mat\X.south) -- (mat\X.north) -- (mat\X.north west) -- cycle; }
\end{scope}
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment