# subfigures in array

How do I create a figure using subfigures with this alignment?:

|figure 1 | figure 3 | figure 4 |
|figure 2 |          |          |


Note that I want figure 3 to be in both rows and figure 4 to be in both rows as well. I have seen that the multirow package is necessary, however if I use it I am getting a wrong ordering (horizontal instead of vertical). Is there anyway to bypass this?

This is a followup question to this one: how to put subfigures in several rows

Note that the solution is essentially the same, but I am having trouble labelling the order of the subfigures.

EDIT: Code seems to work this way! *I'm using the subfigure package instead.

\begin{figure}[t]
\setlength{\abovecaptionskip}{-5pt}
\setlength{\belowcaptionskip}{-5pt}

\centering
\begin{tabular}{ccc}
\subfigure[car image pair]{\includegraphics[scale=0.17]{car_example.jpg}
\label{fig:img_pair_1}} &
\multirow{-4}[2.5]{*}{\subfigure[car image set]{\includegraphics[scale=0.136]{car_total.jpg}
\label{fig:img_complete_1}}} &
\multirow{-4}[2.5]{*}{\subfigure[animal image set]{\includegraphics[scale=0.136]{aww_total.jpg}
\label{fig:img_complete_2}}} \\
\subfigure[animal image pair]{\includegraphics[scale=0.17]{aww_example.jpg}
\label{fig:img_pair_2}}\\
\end{tabular}
\vspace{10pt}
\caption[]{Caption}
\label{fig:affinity}
\vspace{-10pt}
\end{figure}

-
Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. –  Speravir Jan 30 at 1:29
multirow is not necessary, as can already be seen by answers on the linked question and now also to your question. Next time you ask a question add, please, a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. –  Speravir Jan 30 at 1:41

You can modify the answers in the linked question accordingly by using either a minipage or tabular or tabularx. I have used minipage:

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

\begin{document}

\begin{figure}
\begin{minipage}[b][6cm]{0.3\linewidth}
\subfloat[A]{\includegraphics[width=3cm,height=2cm]{logo}}

\vfill
\subfloat[B]{\includegraphics[width=3cm,height=2cm]{logo}}
\end{minipage}%
\begin{minipage}[t][6cm]{0.3\linewidth}
\subfloat[D]{\includegraphics[width=3cm,height=6cm]{logo}}
\end{minipage}%
\begin{minipage}[t][6cm]{0.3\linewidth}
\subfloat[D]{\includegraphics[width=3cm,height=6cm]{logo}}
\end{minipage}
\caption{Many figures}\label{foo}
\end{figure}

\end{document}


-
When I change subfloat for subfigures I'm still not getting the layout I want. It's showing A and B vertically, but on a row on top of C and D instead of having all of them in the same "virtual row" –  Arturo Jan 31 at 1:20
@Arturo Can you show your code in the question? –  Harish Kumar Jan 31 at 2:28
I added the code in the question EDIT section. It's working now, but I had to do some tweaking. Thanks! –  Arturo Jan 31 at 5:49

One option using floatrow and subfig:

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

\begin{document}

\begin{figure}
\ffigbox[][7.8cm]{%
\begin{subfloatrow}
\hsize0.54\hsize
\vbox to 6.35cm{%
\ffigbox[\FBwidth]
{\caption{subfigure-a}}
{\includegraphics[width=3cm,height=2cm]{smallpicture1}}\vss
\ffigbox[\FBwidth]
{\caption{subfigure-b}}
{\includegraphics[width=3cm,height=2cm]{smallpicture2}}
}%
\end{subfloatrow}
\begin{subfloatrow}
\ffigbox[\FBwidth][]
{\caption{subfigure-c}}
{\includegraphics[width=3cm,height=6cm]{bigpicture1}}
\ffigbox[\FBwidth][]
{\caption{subfigure-d}}
{\includegraphics[width=3cm,height=6cm]{bigpicture2}}
\end{subfloatrow}\hspace*{\columnsep}%
}{\caption{four subfigures}}
\end{figure}

\end{document}


Depending on the actual size of your figures, you might need to adjust the settings in the first subfloatrow.

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

-

An alternative where varwidth package and a dummy frame are used, to achieve the desired layout given by the OP.

Code

\documentclass{article}
\usepackage{subfigure}
\usepackage{varwidth,xcolor}
\usepackage[demo]{graphicx}
\usepackage[margin=1cm]{geometry}

\begin{document}

\begin{figure}[!h]
\centering
\begin{varwidth}{0.5\linewidth}  % this is a must
\subfigure[Frame 1]{\includegraphics[width=4cm]{im1.png}}\\
\subfigure[Frame 2]{\includegraphics[width=4cm]{im2.png}}
\end{varwidth}
\begin{varwidth}{0.5\linewidth}  % this is a must
\subfigure[Frame 3]{\includegraphics[width=4cm]{im1.png}}
\subfigure[Frame 4]{\includegraphics[width=4cm]{im2.png}}\\
\color{white}
\subfigure[Dummy Frame]{\includegraphics[draft,width=4cm]{dummy}}
\color{black}
\end{varwidth}
\caption{caption.}
\label{farraypicture}
\end{figure}

\end{document}


Edit: Suggested by Harish Kumar due to depreciated package, here subcaption along with caption packages are used.

and this is the code for the image above. (Both subcaptonbox command and subfigure environments are presented.)

\documentclass{article}
\usepackage{subcaption}
\usepackage{caption}
\usepackage{varwidth,xcolor}
\usepackage[demo]{graphicx}
\usepackage[margin=1cm]{geometry}

\captionsetup[figure]{labelfont=it,textfont={bf,it},labelsep=none}
\renewcommand{\thesubfigure}{(\alph{subfigure})~}
\renewcommand{\thefigure}{\arabic{figure}: }

\begin{document}

Use of subfloat command

\begin{figure}[!h]
\centering
\begin{varwidth}{0.33\linewidth}  % this is a must
\subcaptionbox{Frame 1}{\includegraphics[width=4cm]{im1.png}}
\subcaptionbox{Frame 2}{\includegraphics[width=4cm]{im2.png}}\\
\begin{varwidth}{0.66\linewidth}  % this is a must
\subcaptionbox{Frame 4}{\includegraphics[width=4cm]{im4.png}}\\
\begin{subfigure}{1in}
\color{white}
\includegraphics[width=1in]{dummy}
\caption*{}
\color{black}
\end{subfigure}
\end{varwidth}
\caption{caption}
\label{arraypicture}
\end{figure}

Use of subfigure environment

\begin{figure}[!h]
\centering
\begin{varwidth}{0.33\linewidth}  % this is a must
\begin{subfigure}{4cm}
\includegraphics[width=4cm]{im1.png}
\caption{Frame 1}
\end{subfigure}\\
\begin{subfigure}{4cm}
{\includegraphics[width=4cm]{im2.png}}
\caption{Frame 2}
\end{subfigure}
\begin{varwidth}{0.66\linewidth}  % this is a must
\begin{subfigure}{4cm}
\includegraphics[width=4cm]{im3.png}
\caption{Frame 3}
\begin{subfigure}{4cm}
{\includegraphics[width=4cm]{im4.png}}
\caption{Frame 4}
\end{subfigure}\\
\begin{subfigure}{1in}
\color{white}
\includegraphics[width=1in]{dummy}
\caption*{}
\color{black}
\end{subfigure}
\end{varwidth}
\caption{caption}
\label{arraypicture}
\end{figure}
\end{document}

-