如何对图形中的图像进行分组?

如何对图形中的图像进行分组?

我想对图像进行分组,并在由多个这样的组组成的图中分配相同的子图编号。请看下图以正确理解我的问题。

图像

答案1

两个选项,但总体思路是相同的:为每个组使用一个subfigure环境(requires subcaption)或\subfloat命令(requires )。subfig

这是一个使用强大的subcaption包裹:

\documentclass{article}
\usepackage{subcaption}
\usepackage{graphicx}

\begin{document}

\begin{figure}
  \begin{subfigure}{\linewidth}
  \includegraphics[width=.3\linewidth]{example-image-a}\hfill
  \includegraphics[width=.3\linewidth]{example-image-a}\hfill
  \includegraphics[width=.3\linewidth]{example-image-a}
  \caption{}
  \end{subfigure}\par\medskip
  \begin{subfigure}{\linewidth}
  \includegraphics[width=.3\linewidth]{example-image-b}\hfill
  \includegraphics[width=.3\linewidth]{example-image-b}\hfill
  \includegraphics[width=.3\linewidth]{example-image-b}
  \caption{}
  \end{subfigure}\par\medskip
  \begin{subfigure}{\linewidth}
  \includegraphics[width=.3\linewidth]{example-image-c}\hfill
  \includegraphics[width=.3\linewidth]{example-image-c}\hfill
  \includegraphics[width=.3\linewidth]{example-image-c}
  \caption{}
  \end{subfigure}
  \caption{Some grouped images}
\end{figure}

\end{document}

输出:

在此处输入图片描述

现在有了subfig包裹:

\documentclass{article}
\usepackage{subfig}
\usepackage{graphicx}

\begin{document}

\begin{figure}
  \subfloat[]{%
  \begin{minipage}{\linewidth}
  \includegraphics[width=.3\linewidth]{example-image-a}\hfill
  \includegraphics[width=.3\linewidth]{example-image-a}\hfill
  \includegraphics[width=.3\linewidth]{example-image-a}%
  \end{minipage}%
  }\par
  \subfloat[]{%
  \begin{minipage}{\linewidth}
  \includegraphics[width=.3\linewidth]{example-image-b}\hfill
  \includegraphics[width=.3\linewidth]{example-image-b}\hfill
  \includegraphics[width=.3\linewidth]{example-image-b}%
  \end{minipage}%
  }\par
  \subfloat[]{%
  \begin{minipage}{\linewidth}
  \includegraphics[width=.3\linewidth]{example-image-c}\hfill
  \includegraphics[width=.3\linewidth]{example-image-c}\hfill
  \includegraphics[width=.3\linewidth]{example-image-c}%
  \end{minipage}%
  }
  \caption{Some grouped images}
\end{figure}

\end{document}

输出:

在此处输入图片描述

另一个选择可能是使用floatrow包裹。

答案2

尝试这个

\begin{figure}{h}
\subfigure[caption 1]{\label{...}
\includegraphics{img1-a}\hspace{1em}
\includegraphics{img1-b}\hspace{1em}
\includegraphics{img1-c}
}
subfigure[caption 2]{\label{...}
\includegraphics{img2-a}\hspace{1em}
\includegraphics{img2-b}\hspace{1em}
\includegraphics{img2-c}
}

\caption{}
\label{}
\end{figure}

相关内容