[Tex/LaTex] Align pictures in subfigure

floatshorizontal alignmentsubfloats

I'm having troubles with the subfigure package and proper alignment of figures. I'm inexperienced with Latex so please apologize obvious mistakes. The top-left figure is not properly aligned with the figures that follow below. It should be more to the left (please see attached screenshot). Shortened code:

\begin{figure}[h]
hfill
\subfigure[CEO fixed / total]{\includegraphics[width=8cm]{figures/scatter_cash_CapIQ_CEOfixed_to_total.png}}
\hfill
\subfigure[CEO bonus / total]{\includegraphics[width=8cm{figures/scatter_cash_CapIQ_CEObonus_to_total.png}}
\hfill
\subfigure[CEO long-term / total]{\includegraphics[width=8cm]{figures/scatter_cash_CapIQ_CEOlongterm_to_total.png}}
\hfill
\caption{Compensation measures}
\end{figure}


Try this solution.

\documentclass{article}

\usepackage{graphicx}

\usepackage{caption}
\usepackage{subcaption}

\begin{document}

\begin{figure}[!h]
\centering
\begin{tabular}[c]{cc}
\begin{subfigure}[c]{0.4\textwidth}
\includegraphics[width=\textwidth]{figures/scatter_cash_CapIQ_CEOfixed_to_total.png}
\caption{CEO fixed / total}
\label{fig:ceoa}
\end{subfigure}&
\begin{subfigure}[c]{0.4\textwidth}
\includegraphics[width=\textwidth]{figures/scatter_cash_CapIQ_CEOfixed_to_total.png}
\caption{CEO fixed / total}
\label{fig:ceob}
\end{subfigure}\\
\begin{subfigure}[c]{0.4\textwidth}
\includegraphics[width=\textwidth]{figures/scatter_cash_CapIQ_CEOfixed_to_total.png}
\caption{CEO fixed / total}
\label{fig:ceoc}
\end{subfigure}&
\begin{subfigure}[c]{0.4\textwidth}
\includegraphics[width=\textwidth]{figures/scatter_cash_CapIQ_CEOfixed_to_total.png}
\caption{CEO fixed / total}
\label{fig:ceod}
\end{subfigure}\\
\end{tabular}
\caption{Compensation measures}
\label{fig:ceo}
\end{figure}

\end{document}


How it works?

1. You use a tabular environment to control positioning of your subfigures. Each figure is in a cell in the table. The columns are centered. So the figures remain horizontally aligned even if you change the figure size.
2. Each subfigure has [c] as position specifier. So, again, the figures remain vertically aligned in a row.
3. Should you need to change the figure sizes, please change the multiplier with \textwidth (0.4 in this case. So, two side-by-side figures take 0.4 X 2 = 0.8 of your text width, leaving enough white space). Do not make them very large though, you will get overfull boxes.