0

I am trying to recreate the following table, which has a diagonal grid with regular numbers in it. Is there any efficient way of doing it without drawing / positioning everthing manually? I have looked through the TikZ/PGF manual, but couldn't find anything.

enter image description here

3

Welcome to TeX.SE! The purpose of this site is to help you if you get stuck somewhere with your attempts. If you post an attempt, then the one answering does not have to punch in numbers from a screen shot. Anyway, here is a proposal that reproduces your screen shot. (If you play with transform canvas, please use it with care.) EDIT: Fixed the column and row seps, big thanks to @Skillmon!)

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{matrix,shapes.geometric,positioning}
\begin{document}
\begin{tikzpicture}
 \matrix[matrix of nodes,transform canvas={rotate=45},%
 nodes={regular polygon,regular polygon sides=4,draw,rotate=-45,shape border rotate=45},
 row sep=-\pgflinewidth,column sep=-\pgflinewidth]
 (mat)
 {03 & 13 & 23 & 33 \\ 
 02 & 12 & 22 & 32 \\ 
 01 & 11 & 21 & 31 \\ 
 00 & 10 & 20 & 30 \\ 
 };
 % transform canvas does not transform the bounding box, that's why we need
 \path ([xshift=-3mm,yshift=3mm]mat.south west |- mat.north west) rectangle 
 ([xshift=3mm,yshift=-3mm]mat.south east -| mat.north east);
 \node at (mat.south west) {$\Phi_1$};
 \node at (mat.south east) {$\Phi_2$};
\end{tikzpicture}
\end{document}

enter image description here

  • 2
    I think (not sure about it, my viewer could trick me), that a column sep=-\pgflinewidth and row sep=-\pgflinewidth is better and results in the same rule thickness as the surrounding one. – Skillmon Jan 25 at 18:43

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.