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}
Best Answer
Do you mean something like this?
In order to have figure
A
andB
on the same line there must be no blank lines between thesubfigure
environments. You can adjust the distance adding a\hfill
(or a\hspace{}
) between them. The vertical space before figureC
can be adjusted changing the value of\vspace{}
.Of course you can change the width of all
subfigure
s to get three images with the same dimensions:I obtained this new figure setting the following widths:
A
:width=0.5\linewidth
;B
:width=0.5\linewidth
;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:
Therefore, if you want to put figure
C
belowA
, you only need this code:that produces: