2

this isn't my first language), I am just starting out with the tikzpicture environment. Can anyone show me a better method to implement this enter image description here I would also like to have the smaller arrow pointer and center the elements in all arrays without doing it manually :)

I post my horrible code

\documentclass{article}
\usepackage[T1]{fontenc}        
\usepackage[utf8]{inputenc}     
\usepackage[italian]{babel}     
\usepackage{amsmath}
\usepackage{tikz} % TikzPictures
\usepackage{pgfplots}
\usepackage{graphicx}
\usepackage{float}
    \begin{document}
    \begin{figure}[H]
        \centering
        %\begin{center}
            \tikzset{every picture/.style={line width=0.75pt}} %set default line width to 0.75pt  
            \begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
            
            % Shape: Rectangle 
            \draw   (200,100) -- (350,100) -- (350,250) -- (200,250) -- cycle ;
            
            % Straight Lines 
            \draw    (230,100) -- (230,250) ;
    
            \draw    (260,100) -- (260,250) ;
    
            \draw    (290,100) -- (290,250) ;
    
            \draw    (320,100) -- (320,250) ;
    
            \draw    (200,130) -- (350,130) ;
    
            \draw    (200,160) -- (350,160) ;
    
            \draw    (200,190) -- (350,190) ;
    
            \draw    (200,220) -- (350,220) ;
    
            \draw    (220,80) -- (220,100) ;
    
            \draw    (220,80) -- (370,80) ;
    
            \draw    (350,230) -- (370,230) ;
    
            \draw    (240,60) -- (240,80) ;
    
            \draw    (240,60) -- (390,60) ;
    
            \draw    (250,80) -- (250,100) ;
    
            \draw    (370,80) -- (370,230) ;
    
            \draw    (310,80) -- (310,100) ;
    
            \draw    (340,80) -- (340,100) ;
    
            \draw    (280,80) -- (280,100) ;
    
            \draw    (350,110) -- (370,110) ;
    
            \draw    (370,90) -- (390,90) ;
    
            \draw    (350,140) -- (370,140) ;
    
            \draw    (350,170) -- (370,170) ;
    
            \draw    (350,200) -- (370,200) ;
    
            \draw    (300,60) -- (300,80) ;
    
            \draw    (270,60) -- (270,80) ;
    
            \draw    (330,60) -- (330,80) ;
    
            \draw    (360,60) -- (360,80) ;
    
            \draw    (390,60) -- (390,210) ;
    
            \draw    (370,120) -- (390,120) ;
    
            \draw    (370,150) -- (390,150) ;
    
            \draw    (370,180) -- (390,180) ;
    
            \draw    (370,210) -- (390,210) ;
     
            % arrow L(w)
            \draw    (190,100) -- (190,247) ;
            \draw [shift={(190,250)}, rotate = 270] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (10.72,-5.15) -- (0,0) -- (10.72,5.15) -- (7.12,0) -- cycle    ;
            
            % arrow time
            \draw    (200,260) -- (347,260) ;
            \draw [shift={(350,260)}, rotate = 180] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (10.72,-5.15) -- (0,0) -- (10.72,5.15) -- (7.12,0) -- cycle    ;
    
            % arrow surface
            \draw [line width=0.75]    (360,260) -- (407.88,212.12) ;
            \draw [shift={(410,210)}, rotate = 135] [fill={rgb, 255:red, 0; green, 0; blue, 0 }  ][line width=0.08]  [draw opacity=0] (10.72,-5.15) -- (0,0) -- (10.72,5.15) -- (7.12,0) -- cycle    ;
            
            
            
    
            %------------------------------------------ X matrix time 
            \draw (295,110.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$ \dotsc $};
    
            \draw (209,110.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$t_{0}$};
    
            \draw (239,110.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$t_{1}$};
    
            \draw (269,110.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$t_{2}$};
    
            \draw (330,110.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$T$};
            %-------------------------------------------
            
            %------------------------------------------- Y matrix time
            % Text Node
            \draw (350,85) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$T$};
            % Text Node
            \draw (289,85) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$t_{2}$};
            % Text Node
            \draw (259,85) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$t_{1}$};
            % Text Node
            \draw (229,85) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$t_{0}$};
            % Text Node
            \draw (317,88.5) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$ \dotsc $};
            % Text Node
            %-------------------------------------------
            
            %------------------------------------------- Z matrix time
            \draw (369,64.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$T$};
            % Text Node
            \draw (308,64.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$t_{2}$};
            % Text Node
            \draw (278,64.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$t_{1}$};
            % Text Node
            \draw (248,64.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$t_{0}$};
            % Text Node
            \draw (336,68) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$ \dotsc $};
            
            
            % Text Node
            \draw (250,262) node [anchor=north west][inner sep=0.75pt]  [font=\footnotesize] [align=left] {tempo};
            
            
            % Text Node
            \draw (172,179) node [anchor=north west][inner sep=0.75pt]  [font=\footnotesize,rotate=-270] [align=left] {$\displaystyle L( \omega )$};
            
            
            % Text Node
            \draw (387,238) node [anchor=north west][inner sep=0.75pt]  [font=\footnotesize] [align=left] {surface};
            
            
            % Text Node
            \draw (349,209.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$y_{\omega _{N}}^{T}$};
            % Text Node
            \draw (349,119.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$y_{\omega _{1}}^{T}$};
            % Text Node
            \draw (349,149.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$y_{\omega _{2}}^{T}$};
            % Text Node
            \draw (369,127.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$z_{\omega _{2}}^{T}$};
            % Text Node
            \draw (369,97.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$z_{\omega _{1}}^{T}$};
            % Text Node
            \draw (369,187.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$z_{\omega _{N}}^{T}$};
            % Text Node
            \draw (295,190) node [anchor=north west][inner sep=0.75pt]    {$\ddots $};
            % Text Node
            \draw (325,226.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$x_{\omega _{N}}^{T}$};
            % Text Node
            \draw (235,135.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$x_{\omega _{1}}^{t_{1}}$};
            % Text Node
            \draw (325,136.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$x_{\omega _{1}}^{T}$};
            % Text Node
            \draw (211,190) node [anchor=north west][inner sep=0.75pt]    {$\vdots $};
            % Text Node
            \draw (205,135.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$x_{\omega _{1}}^{t_{0}}$};
            % Text Node
            \draw (205,165.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$x_{\omega _{2}}^{t_{0}}$};
            % Text Node
            \draw (205,225.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$x_{\omega _{N}}^{t_{0}}$};
            % Text Node
            \draw (265,135.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$x_{\omega _{1}}^{t_{2}}$};
            % Text Node
            \draw (295,135.6) node [anchor=north west][inner sep=0.75pt]    {$\dotsc $};
            % Text Node
            \draw (235,165.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$x_{\omega _{2}}^{t_{1}}$};
            % Text Node
            \draw (265,165.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$x_{\omega _{2}}^{t_{2}}$};
            % Text Node
            \draw (325,166.6) node [anchor=north west][inner sep=0.75pt]  [font=\small]  {$x_{\omega _{2}}^{T}$};
            \end{tikzpicture}
        %\end{center}
        \caption{Mark~to~market~cube}
    \end{figure}
    \end{document}
1
  • Welcome :) // A hint: many times the links to the right (Related) provide useful links.
    – MS-SPO
    May 22 at 11:57

1 Answer 1

1

In my opinion, pseudo 3D with plain TikZ is enough. Even I don't use different layers, just use the natural order of drawing command to make some scopes: draw first, appear first! Three scopes are 3 layers - matrix nodes.

enter image description here

\documentclass[tikz,border=5mm]{standalone}
\usetikzlibrary{matrix}
\tikzset{matrixlayer/.style={
matrix of math nodes,nodes in empty cells,
nodes={draw=#1,fill=#1!15,minimum size=10mm,anchor=center,text=black},
column sep=-.5*\pgflinewidth,
row sep=-.5*\pgflinewidth
}}
\begin{document}
\begin{tikzpicture}[>=stealth]
\begin{scope}[shift={(45:2)}]
\node[matrixlayer=red] (m3){
t_0& t_1 & t_2 & \cdots & T\\
z_{\omega_1}^{t_0}&z_{\omega_1}^{t_1}&z_{\omega_1}^{t_2}&\cdots&z_{\omega_1}^T \\
z_{\omega_2}^{t_0}&z_{\omega_2}^{t_1}&z_{\omega_2}^{t_2}&\cdots&z_{\omega_2}^T \\
\vdots&\vdots&\vdots&\ddots&\vdots\\
z_{\omega_N}^{t_0}&z_{\omega_N}^{t_1}&z_{\omega_N}^{t_2}&\cdots&z_{\omega_N}^T \\
};
\end{scope}
\begin{scope}[shift={(45:1)}]
\node[matrixlayer=teal] (m2){
t_0& t_1 & t_2 & \cdots & T\\
y_{\omega_1}^{t_0}&y_{\omega_1}^{t_1}&y_{\omega_1}^{t_2}&\cdots&y_{\omega_1}^T \\
y_{\omega_2}^{t_0}&y_{\omega_2}^{t_1}&y_{\omega_2}^{t_2}&\cdots&y_{\omega_2}^T \\
\vdots&\vdots&\vdots&\ddots&\vdots\\
y_{\omega_N}^{t_0}&y_{\omega_N}^{t_1}&y_{\omega_N}^{t_2}&\cdots&y_{\omega_N}^T \\
};
\end{scope}

\begin{scope}
\node[matrixlayer=blue] (m1){
t_0& t_1 & t_2 & \cdots & T\\
x_{\omega_1}^{t_0}&x_{\omega_1}^{t_1}&x_{\omega_1}^{t_2}&\cdots&x_{\omega_1}^T \\
x_{\omega_2}^{t_0}&x_{\omega_2}^{t_1}&x_{\omega_2}^{t_2}&\cdots&x_{\omega_2}^T \\
\vdots&\vdots&\vdots&\ddots&\vdots\\
x_{\omega_N}^{t_0}&x_{\omega_N}^{t_1}&x_{\omega_N}^{t_2}&\cdots&x_{\omega_N}^T \\
};
\end{scope}

\begin{scope}[->,thick]
\draw ([shift={(0,-.3)}]m1.south west)--([shift={(0,-.3)}]m1.south east) node[midway,below]{tempo};
\draw ([shift={(.5,0)}]m1.south east)--([shift={(.5,0)}]m3.south east) node[midway,right]{surface};
\draw ([shift={(-.3,0)}]m1.north west)--([shift={(-.3,0)}]m1.south west) node[midway,rotate=90,above]{$L(\omega)$};
\end{scope}
\end{tikzpicture}
\end{document}
1
  • 1
    thanks for all tips :)
    – SimoPape
    May 22 at 14:13

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.