19

I have 13 graphs that I am generating with gnuplot and I want to combine them into a single figure that spans two columns of a paper. An example of what I want to do is shown in the following image from this paper.

example image

I don't have the source code for that paper and I don't even know if they used Latex, but I figure the picture might be helpful to explain what I want to do. Essentially I want to have a bunch of graphs that I generate with gnuplot grouped together in one figure in Latex.

I have used subfigure in the past for putting two images next to each other but I'm not sure how I would go about aligning a large number of images. Alternatively I could see if gnuplot can generate a single eps file that has all the plots that I need. However, I would prefer to do the grouping in latex because otherwise I would have to regenerate all the plots even if I only wanted to update one.

But if latex does not have a good way to do what I'm asking then I can look at alternatives. The reason for my question right now is to see if anyone has a recommendation of a good way to do what I want.

1
  • TikZ should be able to solve it. Commented Nov 30, 2012 at 0:25

1 Answer 1

30

This is a simple approach using tabular

\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}
\usepackage{subcaption}

\begin{document}
\begin{figure}[htb]
\centering
  \begin{tabular}{@{}cccc@{}}
    \includegraphics[width=.23\textwidth]{example-image-a} &
    \includegraphics[width=.23\textwidth]{example-image-b} &
    \includegraphics[width=.23\textwidth]{example-image-c} &
    \includegraphics[width=.23\textwidth]{example-image}   \\
    \includegraphics[width=.23\textwidth]{example-image-a} &
    \includegraphics[width=.23\textwidth]{example-image-b} &
    \includegraphics[width=.23\textwidth]{example-image-c} &
    \includegraphics[width=.23\textwidth]{example-image}   \\
    \includegraphics[width=.23\textwidth]{example-image-a} &
    \includegraphics[width=.23\textwidth]{example-image-b} &
    \includegraphics[width=.23\textwidth]{example-image-c} &
    \includegraphics[width=.23\textwidth]{example-image}   \\
    \multicolumn{4}{c}{\includegraphics[width=.23\textwidth]{example-image-a}}
  \end{tabular}
  \caption{This is   some figure side by side}
\end{figure}
\end{document}

enter image description here

Now using subcaption that provides a subfigure command.

\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}
\usepackage{subcaption}

\begin{document}
\begin{figure}[htb]
\centering
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-a}
    \caption{A subfigure}\label{fig:1a}
  \end{subfigure}%   
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-b}
    \caption{A subfigure}\label{fig:1b}
  \end{subfigure}%  
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-c}
    \caption{A subfigure}\label{fig:1c}
  \end{subfigure}%  
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image}
    \caption{A subfigure}\label{fig:1d}
  \end{subfigure}\\%   
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-a}
    \caption{A subfigure}\label{fig:1e}
  \end{subfigure}%
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-b}
    \caption{A subfigure}\label{fig:1f}
  \end{subfigure}%
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-c}
    \caption{A subfigure}\label{fig:1g}
  \end{subfigure}%
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image}
    \caption{A subfigure}\label{fig:1h}
  \end{subfigure}\\%     
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-a}
    \caption{A subfigure}\label{fig:1i}
  \end{subfigure}%
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-b}
    \caption{A subfigure}\label{fig:1j}
  \end{subfigure}%
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image-c}
    \caption{A subfigure}\label{fig:1k}
  \end{subfigure}%
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image}
    \caption{A subfigure}\label{fig:1l}
  \end{subfigure}\\%  
  \begin{subfigure}[b]{.24\linewidth}
    \centering
    \includegraphics[width=.99\textwidth]{example-image}
    \caption{A subfigure}\label{fig:1m}
  \end{subfigure}%    
  \caption{This is   lot of figures arranged side by side in matrix form with captions for each and a main caption}\label{fig:1}
\end{figure}
\end{document}

enter image description here

You should not be using subfigure which is obsolete. Instead use the new subfig:

\documentclass[a4paper,12pt]{article}
\usepackage{graphicx}
\usepackage{subfig}


\begin{document}
\begin{figure}[htb]
\centering
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image-a}}\hfill
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image-b}}\hfill
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image-c}}\hfill
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image}}\\
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image-a}}\hfill
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image-b}}\hfill
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image-c}}\hfill
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image}}\\
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image-a}}\hfill
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image-b}}\hfill
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image-c}}\hfill
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image}}\\
  \subfloat[A subfigure]{%
    \includegraphics[width=.24\textwidth]{example-image}}
  \caption{This is   lot of figures arranged side by side in matrix form with captions for each and a main caption}\label{fig:1}
\end{figure}
\end{document}
1
  • Your answer was very comprehensive, TY
    – Prelude
    Commented Mar 30, 2015 at 3:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .