\begin{tikzpicture}[font=\footnotesize] \def\cw{0.42} \begin{scope} \foreach \r/\row in {1/{1,2,3,4}, 2/{2,4,1,3}, 3/{3,1,4,2}, 4/{4,3,2,1}} { \foreach \s [count=\col] in \row { \ifcase\numexpr\s-1\relax \fill[blue!18] ({(\col-1)*\cw},{-(\r-1)*\cw}) rectangle +(\cw,-\cw); \or \fill[orange!25] ({(\col-1)*\cw},{-(\r-1)*\cw}) rectangle +(\cw,-\cw); \or \fill[green!20] ({(\col-1)*\cw},{-(\r-1)*\cw}) rectangle +(\cw,-\cw); \or \fill[red!18] ({(\col-1)*\cw},{-(\r-1)*\cw}) rectangle +(\cw,-\cw); \fi \node at ({(\col-0.5)*\cw},{-(\r-0.5)*\cw}) {$\s$}; } } \draw[step=\cw, thin] (0,0) grid (4*\cw,-4*\cw); \draw[thick] (0,0) rectangle (4*\cw,-4*\cw); \node[below] at (2*\cw,-4*\cw) {$L$}; \node at (5.2*\cw,-2*\cw) {$\longleftrightarrow$}; \end{scope} \foreach \s/\perm/\sg/\col in {1/{1,3,2,4}/{-1}/blue!18, 2/{2,1,4,3}/{+1}/orange!25, 3/{3,4,1,2}/{+1}/green!20, 4/{4,2,3,1}/{-1}/red!18} { \begin{scope}[xshift={(6.4+(\s-1)*5.6)*\cw cm}] \foreach \j [count=\r] in \perm { \fill[\col] ({(\j-1)*\cw},{-(\r-1)*\cw}) rectangle +(\cw,-\cw); \node at ({(\j-0.5)*\cw},{-(\r-0.5)*\cw}) {$1$}; } \draw[step=\cw, thin, black!45] (0,0) grid (4*\cw,-4*\cw); \draw[thick] (0,0) rectangle (4*\cw,-4*\cw); \node[below, align=center] at (2*\cw,-4*\cw) {$P_{\s}$\\ $\sgn = \sg$}; \ifnum\s<4 \node at (4.8*\cw,-2*\cw) {$+$}; \fi \end{scope} } \end{tikzpicture}