[Tex/LaTex] Latex Section header and figure won’t print on same page

floatsspacing

I'm trying to print a section that has only figures (no text aside from captions). I have a figure that clearly does not take up a whole page (it takes up half a page at most), but for some reason I get my section header "Model fitting" at the top of a page, then COMPLETE BLANK SPACE under it for the rest of the page, then on the next page the figure I want to include. This is the whole command that I am using for this section (Note I have two figures, but I don't care that the second figure also takes up an entire page):

\FloatBarrier
\subsection{Model fitting}
\begin{figure}
\includegraphics[width=0.5\textwidth]{IRrelation_fitted.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_Logfitted.pdf}
\caption{(left) plot of the IR voltage output as a function of distance with the fitted curve plotted over it.(right) plot of the log of IR voltage as a function of the log distance with the fitted curve plotted over it}
\label{fig: IR relationship}
\end{figure}

\begin{figure}
\includegraphics[width=0.5\textwidth]{IRrelation_diag01.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag02.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag03.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag04.pdf}
\caption{Diagnostic plots for linear regression used on IR sensor data as a function of distance. \textbf{top left:} Plot of residuals \textbf{top right:} quantile plot of residuals \textbf{bottom left:} scale-location plot, \textbf{bottom right:} Cook's distance (influence)}
\label{fig: IR diagnostics}
\end{figure}
\FloatBarrier

Best Answer

Without any text, float behaviour can seem pretty peculiar, LaTeX is just trying to make your document look nice. See great answer on How to influence the position of float environments like figure and table in LaTeX? by Frank Mittelbach.

For your specific problem, I used the placement specifier [!h] for both floats:

\FloatBarrier
\subsection{Model fitting}
\begin{figure}[!ht]
\includegraphics[width=0.5\textwidth]{IRrelation_fitted.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_Logfitted.pdf}
\caption{(left) plot of the IR voltage output as a function of distance with the fitted curve plotted over it.(right) plot of the log of IR voltage as a function of the log distance with the fitted curve plotted over it}
\label{fig: IR relationship}
\end{figure}
\begin{figure}[!ht]
\includegraphics[width=0.5\textwidth]{IRrelation_diag01.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag02.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag03.pdf}
\includegraphics[width=0.5\textwidth]{IRrelation_diag04.pdf}
\caption{Diagnostic plots for linear regression used on IR sensor data as a function of distance. \textbf{top left:} Plot of residuals \textbf{top right:} quantile plot of residuals \textbf{bottom left:} scale-location plot, \textbf{bottom right:} Cook's distance (influence)}
\label{fig: IR diagnostics}
\end{figure}
\FloatBarrier

Gives output:

LaTeX output

EDIT: I've just seen Extra page at beginning of appendix containing big figures with the same problem. It offers another solution using minipage

Related Question