# Special arrangement of subfigures

I need an image with five subfigures arranged this way.

I have tried to use subfig and floatrow, but I haven't been able to place the figures as I need them

-
I found the package \usepackage{textpos} really good for this. Then you would simply place your images in brackets like \begin{textblock}{1}(5.5,2.5){1,1} Some figure \end{textblock}. Read more about the package here mirror.ctan.org/macros/latex/contrib/textpos/textpos.pdf. Another method is using minipages. –  N3buchadnezzar Nov 18 '11 at 2:14

You could use a combination of minipages and subfigure environments (from the subcaption package); a little example:

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

\begin{document}

\begin{figure}
\begin{minipage}{.33\textwidth}
\begin{subfigure}{\linewidth}
\centering
\includegraphics[width=.7\linewidth]{name1}
\caption{First subfigure}
\label{fig:sub1}
\end{subfigure}\\[1ex]
\begin{subfigure}{\linewidth}
\centering
\includegraphics[width=.7\linewidth]{name2}
\caption{Second subfigure}
\label{fig:sub2}
\end{subfigure}
\end{minipage}%
\begin{minipage}{.33\textwidth}
\begin{subfigure}{\linewidth}
\centering
\includegraphics[width=.7\linewidth]{name3}
\caption{Third subfigure}
\label{fig:sub3}
\end{subfigure}
\end{minipage}%
\begin{minipage}{.33\textwidth}
\begin{subfigure}{\linewidth}
\centering
\includegraphics[width=.7\linewidth]{name4}
\caption{Fourth subfigure}
\label{fig:sub4}
\end{subfigure}\\[1ex]
\begin{subfigure}{\linewidth}
\centering
\includegraphics[width=.7\linewidth]{name5}
\caption{Fifth subfigure}
\label{fig:sub5}
\end{subfigure}
\end{minipage}
\caption{Five subfigures}
\label{fig:test}
\end{figure}

\end{document}


I used the demo option for the graphicx package to replace the actual figures with black rectangles and make my code compilable for everyone; do not use that option in your actual code.

-
Gonzalo, perhaps add [!htpb] after \begin{figure} ? Seems like quite a standard thing to do. This way we restrict the floating of the figure quite a bit. Using 4 images, the chances of the figure actually fitting is quite low. Also great solution =) –  N3buchadnezzar Nov 18 '11 at 2:29
@N3buchadnezzar: thanks. As for the placement specifiers, for some time now, I've opted for not using them in my example codes unless the person asking the question explicitly mentions a problem with their use. –  Gonzalo Medina Nov 18 '11 at 3:18

You could use three minipages next to each other:

\documentclass{article}

\usepackage{caption,subcaption}
\begin{document}
\begin{figure}
\centering
\begin{minipage}{0.3\textwidth}
\subcaptionbox{A}{\rule{3cm}{3.5cm}}\\[1ex]
\subcaptionbox{B}{\rule{3cm}{3.5cm}}
\end{minipage}%
\begin{minipage}{0.3\textwidth}
\subcaptionbox{C}{\rule{3cm}{3.5cm}}
\end{minipage}%
\begin{minipage}{0.3\textwidth}
\subcaptionbox{D}{\rule{3cm}{3.5cm}}\\[1ex]
\subcaptionbox{E}{\rule{3cm}{3.5cm}}
\end{minipage}
\caption{Pictures!}
\end{figure}

\end{document}

-
You could add % after the first and second \end{minipage} commands to prevent undesired blank spaces. –  Gonzalo Medina Nov 18 '11 at 2:25
@GonzaloMedina: Good point, thanks! I've also adopted the \\[1ex] from your answer to get nicer vertical spacing. –  Jake Nov 18 '11 at 2:46

Using the subfig package you can use tabulars to arrange the images:

\documentclass{article}
\usepackage{subfig}% http://ctan.org/pkg/subfig
\begin{document}
\begin{figure}[ht]
\begin{tabular}{c}
\subfloat[subfigure 1]{\rule{100pt}{50pt}} \\
\subfloat[subfigure 2]{\rule{100pt}{50pt}}
\end{tabular} \hfill
\begin{tabular}[m]{c}
\subfloat[subfigure 3]{\rule{100pt}{50pt}}
\end{tabular} \hfill
\begin{tabular}{c}
\subfloat[subfigure 4]{\rule{100pt}{50pt}} \\
\subfloat[subfigure 5]{\rule{100pt}{50pt}}
\end{tabular}
\caption{bla bla bla bla bla bla}
\end{figure}
\end{document}


Vertical alignment across the subfigures is obtained using the optional tabular parameter [m] for middle. Using \hfill as suggested will push the columns of subfigures to the outer edges of the text block. If you want these columns evenly spaces, use \null\hfill on the left of the first column and \hfill\null on the right of the last column. Alternatively, a fixed spacing using \hspace{<len>} is also possible, where <len> is any recognized TeX length.

tabular column specification necessarily adds a little horizontal space of \tabcolsep between columns. If you want this removed (for whatever reason), you can use a {@{}c@{}} column specification instead of {c}.

-
Is this the preferred solution when using memoir? –  Neil G Feb 6 at 11:53
@NeilG: You could probably use any of the solutions in the answers in terms of positioning. Although memoir provides its own \subbottom and \subtop sub-figure tools. –  Werner Feb 6 at 15:13
yes, so I figured I could use \subbottom inside a tabular? Yours seems like the least verbose solution. –  Neil G Feb 7 at 0:21
@NeilG: Yes. I've mocked something up (see here) and it seems to work. –  Werner Feb 7 at 0:34
Awesome!! Thank you. This is exactly what I was looking for. –  Neil G Feb 7 at 1:03
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 1, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "math_score": 0.8945050239562988, "perplexity": 3881.7713284148394}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "plain"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "warc_path": "s3://commoncrawl/crawl-data/CC-MAIN-2014-23/segments/1404776420123.16/warc/CC-MAIN-20140707234020-00044-ip-10-180-212-248.ec2.internal.warc.gz"}