I am relatively new with LaTeX. I created an image by
\begin{figure}
\begin{tikzpicture}
....
\end{figure}
\end{tikzpicture}
I just don't know how to refer it in paper body by \ref{compression}, but this command displays the subsection number instead of the figure number.

\labelin your code)? Also, you can use backticks or indent blocks with four spaces to format them as code. – krlmlr Mar 25 '12 at 13:26figurebefore ending thetikzpicture– cmhughes Mar 25 '12 at 16:07