If you use LaTeX and sometimes want to override the TeX macro to get your figure right there you can do it.

You can use the exclamation point !

\begin{figure}[!ht]
\begin{center}
\includegraphics[scale=0.50]{image.png}
\end{center}
\end{figure}


However the results is not really nice as when Tex take care to do the layout. So the win-win solution would be to have Tex taking care of the layout, but force it to put all the figure that belong to a section within that section.

Well that’s pretty easy and the command

\clearpage{}


Just does the trick.

If instead you refer to a figure but instead of the number of the figure you can read the number of the section, this is because you have misplaced the caption with the label.

The label has to go after the caption, otherwise it will refer to the section not to the figure.

Right way:

\begin{figure}[htb]
\begin{center}
\includegraphics[scale=0.50]{image.png}
\caption{A wonderful image!}
\label{fig: image}
\end{center}
\end{figure}


Note the relax [htb]. LaTeX will take care of the position for you.