我认为你需要的不仅仅是这些,但你没有表现出来:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[>=stealth]
\draw[<-] (6,0) node[below] {?} -- (-.5,0);
\draw[->] (0,-.5) -- (0,5) node[left] {$y$};
\draw (0,0) grid (5,1) (2,1) grid (3,4) (4,1) rectangle (5,2);
\end{tikzpicture}
\end{document}