You can control the position of an image using options for the figure environment, e.g. the [h!] in the example below tells LaTeX to put the figure exactly where it appears in the text, instead of letting it 'float' to a particular place in the document.
\begin{figure}[h!]