2

I have five figures I want arranged in three rows of 2, 2 and 1. The first row contains 2 figures (like I want), but for some reason the next three figures are placed in their own rows. I cannot figure out why, I have tried adding \par\medskip which I have seen someone suggest, or combining subfigures and minipage environments, but that hasn't worked either.

\begin{figure}[h]
    \captionsetup{width=0.7\linewidth}
    \begin{subfigure}{.5\linewidth}
    \centering
    \includegraphics[width=70mm,scale=.3]{Figures/07-Appendix/BoxPlots/BoxRugo.png}
    \caption{}
    \label{fig:time1}
    \end{subfigure}%
    \begin{subfigure}{.5\linewidth}
    \centering
    \includegraphics[width=70mm,scale=.3]{Figures/07-Appendix/BoxPlots/BoxFormFac.png}
    \caption{}
    \label{fig:time2}
    \end{subfigure}
    \begin{subfigure}{\linewidth}
    \centering
    \includegraphics[width=70mm,scale=.3]{Figures/07-Appendix/BoxPlots/BoxVert.png}
    \caption{}
    \label{fig:time3}
    \end{subfigure}
    \begin{subfigure}{\linewidth}
    \centering
    \includegraphics[width=70mm,scale=.3]{Figures/07-Appendix/BoxPlots/BoxReg.png}
    \caption{}
    \label{fig:time3}
    \end{subfigure}
    \begin{subfigure}{\linewidth}
    \centering
    \includegraphics[width=70mm,scale=.3]{Figures/07-Appendix/BoxPlots/BoxPerimAreaRat.png}
    \caption{}
    \label{fig:time3}
    \end{subfigure}
    \caption{\textit{Boxplots}}
    \label{fig:time}
    \end{figure}
3
  • your last three subfig are specified to be \linewidth wide (and you have a word-space between them) so naturally they have to be one per line. Commented Apr 12, 2018 at 8:55
  • That makes a lot of sense.. However even if I remove \linewidth, or I set it to 0.5 like the two top ones, they are still each in their own row. I didn't change anything in the top two subfigures, but when I recompiled, they are also in their own row.. Any tips?
    – Karen
    Commented Apr 12, 2018 at 9:02
  • I now recompiled again, and it works with 0.5\linewidth. I have no idea why it works now and didn't earlier.
    – Karen
    Commented Apr 12, 2018 at 9:24

2 Answers 2

2

You're asking to set the last three boxes at \linewidth, so they occupy the whole line.

Use 0.49\columnwidth to leave some space between the figures on the same line and don't use width=70mm and scale=0.3, but width=\textwidth, so the image will be as wide as allowed by subfigure.

If you want the caption text to be in italics, use the appropriate setup, instead of adding explicit formatting instructions.

\documentclass{article}
\usepackage[demo]{graphicx} % <--- remove demo
\usepackage{subcaption}

\captionsetup{textfont=it}

\begin{document}

\begin{figure}[htp]

\begin{subfigure}{0.49\columnwidth}
\centering
\includegraphics[width=\textwidth]{Figures/07-Appendix/BoxPlots/BoxRugo.png}
\caption{}
\label{fig:time1}
\end{subfigure}\hfill
\begin{subfigure}{0.49\columnwidth}
\centering
\includegraphics[width=\textwidth]{Figures/07-Appendix/BoxPlots/BoxFormFac.png}
\caption{}
\label{fig:time2}
\end{subfigure}

\begin{subfigure}{0.49\columnwidth}
\centering
\includegraphics[width=\textwidth]{Figures/07-Appendix/BoxPlots/BoxVert.png}
\caption{}
\label{fig:time3}
\end{subfigure}\hfill
\begin{subfigure}{0.49\columnwidth}
\centering
\includegraphics[width=\textwidth]{Figures/07-Appendix/BoxPlots/BoxReg.png}
\caption{}
\label{fig:time4}
\end{subfigure}

\begin{subfigure}{0.49\columnwidth}
\centering
\includegraphics[width=\textwidth]{Figures/07-Appendix/BoxPlots/BoxPerimAreaRat.png}
\caption{}
\label{fig:time5}
\end{subfigure}

\caption{Boxplots}
\label{fig:time}

\end{figure}

\end{document}

enter image description here

You may want to add \medskip between the rows; if you also add a top level \centering (after \begin{figure}[htp]), you'd get

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{subcaption}

\captionsetup{textfont=it}

\begin{document}

\begin{figure}[htp]
\centering

\begin{subfigure}{0.49\columnwidth}
\centering
\includegraphics[width=\textwidth]{Figures/07-Appendix/BoxPlots/BoxRugo.png}
\caption{}
\label{fig:time1}
\end{subfigure}\hfill
\begin{subfigure}{0.49\columnwidth}
\centering
\includegraphics[width=\textwidth]{Figures/07-Appendix/BoxPlots/BoxFormFac.png}
\caption{}
\label{fig:time2}
\end{subfigure}

\medskip

\begin{subfigure}{0.49\columnwidth}
\centering
\includegraphics[width=\textwidth]{Figures/07-Appendix/BoxPlots/BoxVert.png}
\caption{}
\label{fig:time3}
\end{subfigure}\hfill
\begin{subfigure}{0.49\columnwidth}
\centering
\includegraphics[width=\textwidth]{Figures/07-Appendix/BoxPlots/BoxReg.png}
\caption{}
\label{fig:time4}
\end{subfigure}

\medskip

\begin{subfigure}{0.49\columnwidth}
\centering
\includegraphics[width=\textwidth]{Figures/07-Appendix/BoxPlots/BoxPerimAreaRat.png}
\caption{}
\label{fig:time5}
\end{subfigure}

\caption{Boxplots}
\label{fig:time}

\end{figure}

\end{document}

enter image description here

1

With the subfloatrow environment, from floatrow, it works. Note the syntax is slightly different:

\documentclass{article}
\usepackage[showframe]{geometry}
\usepackage{caption, subcaption}
\usepackage{floatrow}
\usepackage[demo]{graphicx}%

\begin{document}

\begin{figure}[htb]
\floatsetup{capposition = below, floatrowsep =qquad,}
\centering
\ffigbox{%
\begin{subfloatrow}
\centering
\ffigbox[0.5\textwidth]{\caption{}}{%
\includegraphics[width=70mm,scale=.3]{Figures/07-Appendix/BoxPlots/BoxRugo.png}}
\ffigbox[0.5\textwidth]{\caption{}}{%
\includegraphics[width=70mm,scale=.3]{Figures/07-Appendix/BoxPlots/BoxFormFac.png}}
\end{subfloatrow}
\vskip4ex
\begin{subfloatrow}
\ffigbox[0.5\textwidth]{\caption{}}{%
\includegraphics[width=70mm,scale=.3]{Figures/07-Appendix/BoxPlots/BoxVert.png}%
}
\ffigbox[0.5\textwidth]{\caption{}}{%
\includegraphics[width=70mm,scale=.3]{Figures/07-Appendix/BoxPlots/BoxReg.png}%
}
\end{subfloatrow}
\vskip4ex
\begin{subfloatrow}
\ffigbox[\textwidth]{\caption{}}%
{\includegraphics[width=70mm,scale=.3]{Figures/07-Appendix/BoxPlots/BoxPerimAreaRat.png}%
}
\end{subfloatrow}}{
\caption{\textit{Boxplots}}
\label{fig:time}}
\end{figure}

\end{document}

enter image description here

You must log in to answer this question.

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