10

I'm trying to create a multiple panel figure and I want the figures to by side by side (thre are 3 so I want two of them to be side by side and the other one below the first one).

However, I have only been able to get a figure where all three subfigures are one on top of the other

Here is my code

\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}
\begin{document}    
\begin{figure}
\centering
\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-a.pdf} 
\caption{Generic} \label{fig:timing1}
\end{subfigure}

\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-b.pdf} 
\caption{Competitors} \label{fig:timing2}
\end{subfigure}


\begin{subfigure}[t]{0.2\textwidth}
\centering
\includegraphics[width=\textwidth]{example-image-c.pdf} 
\caption{Price regulation} \label{fig:timing3}
 \end{subfigure}

 \caption{Some general caption of all the figures. In (\subref{fig:timing1}) you can see a  green square....}

\end{figure}

\end{document}

enter image description here

1
  • use the minipage, that will work Commented Apr 1, 2021 at 15:32

2 Answers 2

17

Do you mean something like this?

enter image description here

In order to have figure A and B on the same line there must be no blank lines between the subfigure environments. You can adjust the distance adding a \hfill (or a \hspace{}) between them. The vertical space before figure C can be adjusted changing the value of \vspace{}.

\documentclass{article}

\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}

\begin{document}    
\begin{figure}
    \centering
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-a.pdf} 
        \caption{Generic} \label{fig:timing1}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=\linewidth]{example-image-b.pdf} 
        \caption{Competitors} \label{fig:timing2}
    \end{subfigure}

    \vspace{1cm}
    \begin{subfigure}[t]{\textwidth}
    \centering
        \includegraphics[width=\linewidth]{example-image-c.pdf} 
        \caption{Price regulation} \label{fig:timing3}
    \end{subfigure}
    \caption{Some general caption of all the figures. In (\subref{fig:timing1}) you can see a  green square....}
\end{figure}
\end{document}

Of course you can change the width of all subfigures to get three images with the same dimensions:

enter image description here

I obtained this new figure setting the following widths:

  • figure A: width=0.5\linewidth;
  • figure B: width=0.5\linewidth;
  • figure C: width=0.25\linewidth;

You can adjust these values in order to obtain the desired output (or using a different command like \includegraphics[scale=]{}).

EDIT: Re-reading the question I noticed:

...and the other one below the first one...

Therefore, if you want to put figure C below A, you only need this code:

\documentclass{article}

\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}

\begin{document}    
\begin{figure}
    \centering
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=0.5\linewidth]{example-image-a.pdf} 
        \caption{Generic} \label{fig:timing1}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=0.5\linewidth]{example-image-b.pdf} 
        \caption{Competitors} \label{fig:timing2}
    \end{subfigure}

    \vspace{1cm}
    \begin{subfigure}[t]{0.45\textwidth}
        \centering
        \includegraphics[width=0.5\linewidth]{example-image-c.pdf} 
        \caption{Price regulation} \label{fig:timing3}
    \end{subfigure}
    \hfill
    \begin{subfigure}[t]{0.45\textwidth}
        % just an empty subfigure to shift C below A
    \end{subfigure}
    \caption{Some general caption of all the figures. In (\subref{fig:timing1}) you can see a  green square....}
\end{figure}
\end{document}

that produces:

enter image description here

0

try this:

\begin{figure}
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[width=\textwidth]{plots/1-a.png}
\centering
\caption{}
\label{1}
\end{subfigure}
\begin{subfigure}[b]{0.5\textwidth}
\includegraphics[width=\textwidth]{plots/1-b.png}
\centering
\caption{}
\label{2}
\end{subfigure}
\begin{subfigure}[b]{1\textwidth}
\includegraphics[width=0.5\textwidth]{plots/1-c.png}
\centering
\caption{}
\label{3}
\end{subfigure}
\caption{general caption ...}
\end{figure}
\begin{equation}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .