I just cannot debug this code. After typesetting it keeps on giving the error of: "Undefined Control Sequence" When individually coding rectangles for each set of coordinates the code works though, but it is nonetheless cumbersome... What am I missing with \foreach and \draw ???
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\usepackage{tikz}
\pgfplotsset{compat=1.11}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin = 0,
xmax = 10,
ymin = 0,
ymax = 10,
]
\foreach \linker / \regter in {{(1,1) / (2,2)}, {(2,2) / (3,3)},{(3,3)/(4,4)}} {
\edef\temp{\draw[thick] \linker rectangle \regter;
}
\temp
}
\end{axis}
\end{tikzpicture}
\end{document}