将多个 .eps 文件合并为一个图形

将多个 .eps 文件合并为一个图形

我用 gnuplot 生成了 13 个图表,我想将它们组合成一个横跨论文两栏的图表。下图显示了我想要做的事情的一个示例

示例图片

我没有那篇论文的源代码,甚至不知道他们是否使用了 Latex,但我认为这张图片可能有助于解释我想要做的事情。本质上,我想将使用 gnuplot 生成的一堆图表组合在 Latex 中的一个图中。

我过去曾使用过subfigure将两幅图像放在一起,但我不确定如何对齐大量图像。或者,我可以看看 gnuplot 是否可以生成一个包含我需要的所有图的 eps 文件。但是,我更喜欢在 latex 中进行分组,因为否则即使我只想更新一个图,我也必须重新生成所有图。

但是如果 latex 没有好的方法来做我要求的事情,那么我可以考虑其他方法。我现在问这个问题的原因是想看看是否有人能推荐一种好的方法来做我想做的事情。

答案1

这是一个简单的方法,使用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}

在此处输入图片描述

现在使用subcaption它来提供一个subfigure命令。

\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}

在此处输入图片描述

你不应该使用subfigure过时的。而是使用新的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}

相关内容