I would like to draw two grids side by side using TikZ; the left one being a complete square grid, and the right one being a lower-triangular one. I tried writing the following code to make the figure, but \yy is always equal to \y, and it only draws straight lines. What am I doing wrong? Is there a better way to draw the triangular grid?
\begin{tikzpicture}
% Grid
\draw[step=1,color=gray] (0,0) grid (5,5);
% Pads
\draw (4.5,4.5) node {G};
\foreach \x [evaluate=\x as \ystart using int(\x-6), evaluate=\x as \xx using int(\x+1)] in {6, 7,..., 10}
\foreach \y [evaluate=\y as \yy using int(\y+1)] in {\ystart, ..., 4}
\draw [color=gray] (\x,\y) rectangle (\xx,\yy) node {\y, \yy} ;
% Pads
\draw (10.5,4.5) node {G};
\end{tikzpicture}
Best Answer
You need to enclose the content of the
\foreach
loop in curly braces: