# Problems with horizontal aligment of figures using subcaption package

The subfigures do not align horizontally, the (a) subfigure is placed approx. 3 cm lower then the (b)-figure. Can you please see what I'm doing wrong.

\documentclass[english]{article}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{float}
\usepackage{epstopdf}

\begin{document}
\begin{figure}
\caption{Coloured lines}
\centering
\begin{subfigure}[a]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{Colourlines1}
\caption{No treatment}
\end{subfigure}
\begin{subfigure}[b]{0.45\textwidth}
\centering
\includegraphics[width=\textwidth]{Colourlines2}
\caption{Treatment}
\end{subfigure}
\end{figure}
\end{document}

-

It would appear that you're using the optional arguments [a] and [b] to the subfigure environments as a means to number the subfigures. Unfortunately, this won't work correctly because (i) the option is meant to be a location/alignment specifier rather than a numbering specifier and (ii) "a" is not a valid location specifier. (If you examine the log file that's produced by compiling your code, you'll find a warning message to this effect.) "b" just happens to work because it stands for "bottom". To align the subfigures, use either [t] ("top") or [b] ("bottom") as the location specifier for both subfigures.

Separately, the two \centering instructions you provide inside the subfigure environments aren't necessary because the graphs already take up the full widths of the respective environments. You may also want to insert a bit more whitespace between the two floats; I suggest you do so by adding the \hspace{\fill} directive.

The following, modified form of your MWE implements these ideas:

\documentclass{article}
\usepackage[demo]{graphicx} % remove 'demo' option for real document
\usepackage{caption,subcaption}
\begin{document}
\begin{figure}
\caption{Coloured lines}
\begin{subfigure}[t]{0.45\textwidth}
\includegraphics[width=\textwidth]{Colourlines1}
\caption{No treatment}
\end{subfigure}
\hspace{\fill} % separate the two subfigures...
\begin{subfigure}[t]{0.45\textwidth}
\includegraphics[width=\textwidth]{Colourlines2}
\caption{Treatment}
\end{subfigure}
\end{figure}
\end{document}


-