[Tex/LaTex] How to arrange 8 figures, with subcaptions, in a 3-row form

graphicssubfloats

enter image description here

I want to figure out how to make an arrangement of eight figures into a compact form as shown in the picture. Could some give a hand?

Best Answer

Thanks for mentioning in a comment which document class you use -- IEEEtran, with the option conference. Since this document class uses a two-column layout, the first and most important measure to take is to employ a figure* environment, which takes up the width of both columns, instead of a "normal" figure environment.

To position the eight subfigures along with their \captions within the figure* environment, I suggest you load the subcaption package and use that package's subfigure environment. In the following code, the amount of whitespace between the graphs in the third row is set to be same as it is in the first two rows, viz., 0.05\textwidth. If you want more horizontal separation between the graphis in the final row, simply increase the value of the argument of next-to-last \hspace* directive.

enter image description here

\documentclass[conference,demo]{IEEEtran}  % remove 'demo' option in real document
\usepackage{graphicx,subcaption}
\begin{document}

\begin{figure*}
% first row: 3 subfigures
\begin{subfigure}{0.3\textwidth}
   \includegraphics[width=\linewidth]{fa}
   \caption{xxx} \label{fig:x_a}
\end{subfigure}
\hspace*{\fill}
\begin{subfigure}{0.3\textwidth}
   \includegraphics[width=\linewidth]{fb}
   \caption{xxx} \label{fig:x_b}
\end{subfigure}
\hspace*{\fill}
\begin{subfigure}{0.3\textwidth}
   \includegraphics[width=\linewidth]{fc}
   \caption{xxx} \label{fig:x_c}
\end{subfigure}

% 2nd row: 3 more subfigures
\bigskip
\begin{subfigure}{0.3\textwidth}
   \includegraphics[width=\linewidth]{fd}
   \caption{xxx} \label{fig:x_d}
\end{subfigure}
\hspace*{\fill}
\begin{subfigure}{0.3\textwidth}
   \includegraphics[width=\linewidth]{fe}
   \caption{xxx} \label{fig:x_e}
\end{subfigure}
\hspace*{\fill}
\begin{subfigure}{0.3\textwidth}
   \includegraphics[width=\linewidth]{ff}
   \caption{xxx} \label{fig:x_f}
\end{subfigure}

% 3rd row: just 2 subfigures, centered
\bigskip
\hspace*{\fill}
\begin{subfigure}{0.3\textwidth}
   \includegraphics[width=\linewidth]{fg}
   \caption{xxx} \label{fig:x_g}
\end{subfigure}%
\hspace*{0.05\textwidth}%
\begin{subfigure}{0.3\textwidth}
   \includegraphics[width=\linewidth]{fh}
   \caption{xxx} \label{fig:x_h}
\end{subfigure}
\hspace*{\fill}

\caption{yyy}
\end{figure*}

\end{document}
Related Question