# How can I force my subfigures to be aligned?

I have 4 images and I'd like them all to be aligned along their vertical and horizontal edges. The problem is that the caption on the top right image takes up 2 lines, but the caption on the top left image only takes up 1 line, causing them to be misaligned. It looks like this

How can I force them to be aligned? I am using the following packages and template:

\documentclass[annual]{acmsiggraph}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}

\begin{document}

\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.2\textwidth}
\includegraphics[width=\textwidth]{images/donald}
\caption{Original image.}
\label{fig:pearl-original}
\end{subfigure}
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.2\textwidth}
\includegraphics[width=\textwidth]{images/donald_gray}
\caption{The image after blurring and extracting the luminance channel.}
\label{fig:pearl-human}
\end{subfigure}
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.2\textwidth}
\includegraphics[width=\textwidth]{images/donald_sobel_x.png}
\caption{The image after applying a vertical sobel filter.}
\label{fig:pearl-paint}
\end{subfigure}
%(or a blank line to force the subfigure onto a new line)
\begin{subfigure}[b]{0.2\textwidth}
\includegraphics[width=\textwidth]{images/donald_sobel_y.png}
\caption{The image after applying a horizonal sobel filter}
\label{fig:pearl-paint}
\end{subfigure}
\caption{Different stages of the image processing pipeline.}
\label{fig:pipeline}
\end{figure}

\end{document}

• instead \begin{subfigure}[b]{0.2\linewidth} try \begin{subfigure}[t]{0.2\linewidth}. Dec 2, 2018 at 23:29
• @jimjammo, i convert my comment to an answer. Dec 2, 2018 at 23:56

You could use \begin{subfigure}[t]{0.4\linewidth}, that's [t] instead of [b].

I tried with following packages and template:

\documentclass{article}
\usepackage{caption}
\usepackage{graphicx}
\usepackage{subcaption}
\captionsetup{compatibility=false}

\begin{document}

\begin{figure}[h!t!b]
\centering
\begin{subfigure}[t]{0.4\linewidth}     \includegraphics[width=\linewidth]{"image".png}
\caption{image1}
\end{subfigure}
\begin{subfigure}[t]{0.4\linewidth}
\includegraphics[width=\linewidth]{"image".png}
\caption{image2 has a very long caption to be fit}
\end{subfigure}\\
\begin{subfigure}[t]{0.4\linewidth}
\includegraphics[width=\linewidth]{"image".png}
\caption{image3}
\end{subfigure}
\begin{subfigure}[t]{0.4\linewidth}
\includegraphics[width=\linewidth]{"image".png}
\caption{image4}
\end{subfigure}

\caption{Different Images}
\label{Images}
\end{figure}

\end{document}


if the images the same height and caption of different length, than is sensible to align the top of images:

\documentclass{article}     % i haven't your document style,
% however a proposed solution work witha anyone
\usepackage[demo]{graphicx}
\usepackage{caption}
\usepackage{subcaption}

%-------------------------------------- only for show page layout
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.25pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage{lipsum}

\begin{document}
begin{figure}[htbp]
\centering
% images in the first row
\begin{subfigure}[t]{0.2\linewidth}
\includegraphics[width=\linewidth]{images/donald}
\caption{Original image.}
\label{fig:pearl-original}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\linewidth}
\includegraphics[width=\linewidth]{images/donald_gray}
\caption{The image after blurring and extracting the luminance channel.}
\label{fig:pearl-human}
\end{subfigure}

% images in the second row
\begin{subfigure}[t]{0.2\linewidth}
\includegraphics[width=\linewidth]{images/donald_sobel_x.png}
\caption{The image after applying a vertical sobel filter.}
\label{fig:pearl-paint}
\end{subfigure}
~
\begin{subfigure}[t]{0.2\linewidth}
\includegraphics[width=\linewidth]{images/donald_sobel_y.png}
\caption{The image after applying a horizonal sobel filter}
\label{fig:pearl-paint}
\end{subfigure}
\caption{Different stages of the image processing pipeline.}
\label{fig:pipeline}
\end{figure}
\end{document}


(red lines indicate page layout)

edit: by accident i upload two different codes. also i miss that you like to have images in two rows (this is not evident from your code. now corrected.

in case, that your document has two columns, than for the width of subfigures select

\begin{subfigure}[t]{0.4\linewidth}


or

\begin{subfigure}[t]{0.4\columnwidth}