axis begin compat document lines middle newest pgfplots pgfplotsset stalone tikzpicture
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
axis lines=middle
]
\addplot [white, line width = 1, smooth, domain=-5:5] {x};
\draw (-1,-1) rectangle (1,1);
\draw (1,-1) rectangle (3,1);
\draw (-1,-1) rectangle (-3,1);
\draw (-1,1) rectangle (1,3);
\draw (-1,-1) rectangle (1,-3);
\end{axis}
\end{tikzpicture}
\end{document}