5

I'm using the subfig package to arrange multiple graphics inside a figure. I'm trying to arrange two graphics vertically inside a subfloat but keep getting an error. I'd like the figures to be arranged something like this:

 _____   _____
|_____| |     |
 _____  |     |
|_____| |_____|
  (a)     (b)

But when I try

\begin{figure}
\centering
\subfloat[][]{
    \includegraphics{graph1} \\
    \includegraphics{graph2}
}
\subfloat[][]{
    \includegraphics{graph3}
}
\end{figure}

I get the error Something's wrong--perhaps a missing \item. If I remove the linebreak inside the subfloat the error goes away but then my figures aren't arranged right. How should I be doing this?

5

Here's one option using the subfigure environment from the subcaption package and taking advantage of the optional arguments for the environment (the same as those for a minipage); depending on the actual size of your images, you might need to adjust some lengths: :

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

\begin{document}

\begin{figure}
\centering
\begin{subfigure}[b][6.5cm][b]{.3\textwidth}
\centering
\includegraphics[width=3cm,height=3cm]{smallfigure1}\\\vfill
\includegraphics[width=3cm,height=2cm]{smallfigure2}
\caption{Two small subfigures}
\end{subfigure}%
\begin{subfigure}[b][6.5cm][b]{.3\textwidth}
\centering
\includegraphics[width=3cm,height=6cm]{largefigure}
\caption{A large subfigure}
\end{subfigure}
\caption{three subfigures}
\end{figure}

\end{document}

enter image description here

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

And here's an option using the subfig package and some minipages:

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

\begin{document}

\begin{figure}
\centering
\subfloat[Two small subfigures]{%
\begin{minipage}[b][6.5cm][t]{.3\textwidth}
\centering
\includegraphics[width=3cm,height=2cm]{smallfigure1}

\vfill
\includegraphics[width=3cm,height=2cm]{smallfigure2}
\end{minipage}}%
\subfloat[A larger subfigure]{\begin{minipage}[b][6.5cm][t]{.3\textwidth}
\centering
\includegraphics[width=3cm,height=6.5cm]{largefigure}
\end{minipage}}
\caption{three subfigures}
\end{figure}

\end{document}

enter image description here

You can box the larger image and measure its height to use this value for the minipages height. The mechanism is explained in Aligning 3 images square in a box

| improve this answer | |
  • Is there any way to do this with subfig? – David P May 15 '13 at 2:02
  • @DavidP Sure! Please see my updated answer. – Gonzalo Medina May 15 '13 at 3:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.