# Arranging multiple plots in a grid inside a figure/subfloat

I have a grid of pie charts which go into subfloats. The number is odd, and I would like to have them on a 3x2 grid, where the cell in the bottom left is empty. I have simulated this by putting an empty subfloat in the following example, but obviously that's not good, as I get a sub-caption labelled "(e)" and the caption count is increased:

\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}

\begin{document}

\begin{figure}
\centering
\subfloat[first]{
\includegraphics[width=65mm]{test.pdf}
}
\subfloat[second]{
\includegraphics[width=65mm]{test.pdf}
}
\hspace{0mm}
\subfloat[third]{
\includegraphics[width=65mm]{test.pdf}
}
\subfloat[forth]{
\includegraphics[width=65mm]{test.pdf}
}
\hspace{0mm}
\subfloat[]{   % ???
\includegraphics[width=65mm]{empty.pdf}
}
\subfloat[fifth]{
\includegraphics[width=65mm]{test.pdf}
}
\caption{caption}
\end{figure}

\end{document}


If a naive solution is also OK:

\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}

\begin{document}

\begin{figure}
\begin{tabular}{cc}
\includegraphics[width=65mm]{it} &   \includegraphics[width=65mm]{it} \\
(a) first & (b) second \\[6pt]
\includegraphics[width=65mm]{it} &   \includegraphics[width=65mm]{it} \\
(c) third & (d) fourth \\[6pt]
\multicolumn{2}{c}{\includegraphics[width=65mm]{it} }\\
\multicolumn{2}{c}{(e) fifth}
\end{tabular}
\caption{caption}
\end{figure}
\end{document}


Here is another picture, of course.

• In your screenshot, the fifth sub-figure is centered. I would like to have it aligned with the right column of the grid, i.e. directly under the fourth sub-figure. Oct 26, 2013 at 20:49
• @EmitTaste Oh,I see. Non-centered version is easier, of course. One should only omit \multicolumn etc. Oct 26, 2013 at 20:55
• you hard coded the (a), (b), ....! Oct 26, 2013 at 22:27
• Really great answer, helped me a ton. Aug 25, 2014 at 16:15
• Question, I was trying to use this simple solution, but the captions I am using are too long and the environment isn't wrapping the lines. Nov 14, 2022 at 9:20

Another solution would be to use subfigures. You can get an empty left-bottom cell by increasing the width of the bottom figure (whilst keeping the image width the same) and using \raggedleft.

\usepackage{graphicx}
\usepackage{subcaption}

\begin{document}

\begin{figure}[b]
\centering
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.45\textwidth]{IMAGE NAME}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.45\textwidth]{IMAGE NAME}
\end{subfigure}
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.45\textwidth]{IMAGE NAME}
\end{subfigure}%
\begin{subfigure}{.5\textwidth}
\centering
\includegraphics[width=0.45\textwidth]{IMAGE NAME}
\end{subfigure}
\begin{subfigure}{\textwidth}
\raggedleft
\includegraphics[width=0.45\textwidth]{IMAGE NAME}
\end{subfigure}
\caption[short]{A beautiful, well written caption}
\end{figure}

\end{document}


You then get something like this: (I used some graphs I was working with as a place holder):

(You can still add subcaptions etc using the subfigure package). Let me know if you have any further questions.

• What about the caption of the last figure? With your solution, it will get centered in the middle of the page, isn't it? Apr 9, 2022 at 11:24

I figured, a simple solution it prepend a \hbox to 67.5mm{} at the right spot:

\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}

\begin{document}

\begin{figure}
\centering
\subfloat[first]{
\includegraphics[width=65mm]{test.pdf}
}
\subfloat[second]{
\includegraphics[width=65mm]{test.pdf}
}
\newline
\subfloat[third]{
\includegraphics[width=65mm]{test.pdf}
}
\subfloat[forth]{
\includegraphics[width=65mm]{test.pdf}
}
\newline
\hbox to 67.5mm{}% !!
\subfloat[fifth]{
\includegraphics[width=65mm]{test.pdf}
}
\caption{caption}
\end{figure}

\end{document}