2

I have three figures in a row but they are not aligned properly. the third one is a little bit upper than the other ones.

\begin{figure}[H]
        \begin{subfigure}{.3\textwidth}
            \vspace{0pt}
            \includegraphics[width=1\linewidth]{pion_plot2}
            \caption{Simple exponential fit in Kaon region}
            \label{PionDataExp1}
        \end{subfigure}     
        \begin{subfigure}{.3\textwidth}
            \includegraphics[width=1\linewidth]{pion_plot3a}
            \caption{Exponential fit with background fit in Kaon region}
            \label{PionDataExp2}
        \end{subfigure}
        \begin{subfigure}{.3\textwidth}
            \includegraphics[width=1\linewidth]{pion_plot3b}
            \caption{Exponential fit with fixed background for last 10 channels in Kaon region}
            \label{PionDataExp3}
        \end{subfigure}
        \caption{Kaon region fits in region 45 to 60 ns}
        \label{PionDataExp}
    \end{figure}

I would like to make them align from top. Any idea?

  • 1
    Use \begin{subfigure}[t]{.3\textwidth} and either add \vspace{0pt} in all of them or in none. – egreg Mar 13 '16 at 19:16

1 Answers1

7

You need to (a) add the [t] position specifier to all three subfigure environments, (b) remove (or comment out) the \vspace{0pt} instruction in the first subfigure, and (c) [optional but still advisable] add \hfill instructons after each of the first two subfigures; doing so will generate a bit more visual separation.

enter image description here

\documentclass[demo]{article} % remove 'demo' option in real document
\usepackage{graphicx,subcaption,float}
\begin{document}
\begin{figure}[H]
        \begin{subfigure}[t]{.3\textwidth}
            %%%\vspace{0pt}
            \includegraphics[width=1\linewidth]{pion_plot2}
            \caption{Simple exponential fit in Kaon region}
            \label{PionDataExp1}
        \end{subfigure}\hfill%   
        \begin{subfigure}[t]{.3\textwidth}
            \includegraphics[width=1\linewidth]{pion_plot3a}
            \caption{Exponential fit with background fit in Kaon region}
            \label{PionDataExp2}
        \end{subfigure}\hfill%
        \begin{subfigure}[t]{.3\textwidth}
            \includegraphics[width=1\linewidth]{pion_plot3b}
            \caption{Exponential fit with fixed background for last 10 channels in Kaon region}
            \label{PionDataExp3}
        \end{subfigure}

        \caption{Kaon region fits in region 45 to 60 ns}
        \label{PionDataExp}
    \end{figure}
\end{document}
Mico
  • 506,678