一页上排列多个子图

一页上排列多个子图

我想将 4 组 3 个子图排列在一页上,如附图所示。我希望 4 组子图中的每一个都有自己的图号和标题。是否可以将页面分成四部分,以便我可以在其中放置子图?

在此处输入图片描述

答案1

在一个figure环境中安排尽可能多的subfloatsubfig包)和caption您需要的包。以下代码用于minipages分配图形。

\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\begin{document}
\begin{figure}
\begin{minipage}{.5\textwidth}
\centering
\subfloat[][first]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][second]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][third]{\includegraphics[height=1cm]{example-image}}
\caption{First row, first column}
\end{minipage}
\begin{minipage}{.5\textwidth}\centering
\subfloat[][first]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][second]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][third]{\includegraphics[height=1cm]{example-image}}
\caption{First row, second column}
\end{minipage}\\[2cm]
\begin{minipage}{.5\textwidth}\centering
\subfloat[][first]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][second]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][third]{\includegraphics[height=1cm]{example-image}}
\caption{Second row, first column}
\end{minipage}
\begin{minipage}{.5\textwidth}\centering
\subfloat[][first]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][second]{\includegraphics[height=1cm]{example-image}}\\
\subfloat[][third]{\includegraphics[height=1cm]{example-image}}
\caption{Second row, second column}
\end{minipage}
\end{figure}
\end{document}

在此处输入图片描述

答案2

您可以将多个minipage环境组合在一起,例如\subcaptionbox在一个环境中组合figure

\documentclass{article}

\usepackage{subcaption}
\usepackage{mwe}% for example-image

\begin{document}
\begin{figure}
  \begin{minipage}{.5\linewidth}
    \subcaptionbox{First
      subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-a}}
    \subcaptionbox{Second subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-b}}
    \subcaptionbox{Third
      subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-c}}
    \caption{This is the first figure}
  \end{minipage}%
  \begin{minipage}{.5\linewidth}
    \subcaptionbox{First
      subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-a}}
    \subcaptionbox{Second subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-b}}
    \subcaptionbox{Third
      subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-c}}
    \caption{This is the second figure}
  \end{minipage}

  \bigskip
  \begin{minipage}{.5\linewidth}
    \subcaptionbox{First
      subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-a}}
    \subcaptionbox{Second subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-b}}
    \subcaptionbox{Third
      subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-c}}
    \caption{This is the third figure}
  \end{minipage}%
  \begin{minipage}{.5\linewidth}
    \subcaptionbox{First
      subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-a}}
    \subcaptionbox{Second subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-b}}
    \subcaptionbox{Third
      subfigure}[\linewidth][c]{\includegraphics[height=2em,width=.7\linewidth]{example-image-c}}
    \caption{This is the forth figure}
  \end{minipage}
\end{figure}
\end{document}

自己的号码

注意:每个浮点数floatrow只允许一个\caption,除非你使用,例如\ffigboxfloatrow有关更多信息,请参阅手册第 1.2 节。

答案3

使用tabularxsubfig包的替代方法......

\documentclass{article}
\usepackage{graphicx}% for example-image
\usepackage{subfig}
\usepackage{tabularx}

%-------------------------------- show page layout, only for test
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%

\begin{document}
\begin{figure}
  \begin{tabularx}{\linewidth}{@{}
                        *{2}{>{\centering\arraybackslash}X}
                               @{} }
    \subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-a}}

    \subfloat[First subfigure]     {\includegraphics[height=4em,width=0.8\linewidth]{example-image-b}}

    \subfloat[First subfigure]     {\includegraphics[height=4em,width=0.8\linewidth]{example-image-c}}
    \caption{This is the first figure}
        &
    \subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-a}}

    \subfloat[First subfigure]     {\includegraphics[height=4em,width=0.8\linewidth]{example-image-b}}

    \subfloat[First subfigure]     {\includegraphics[height=4em,width=0.8\linewidth]{example-image-c}}
    \caption{This is the second figure}
        \\
%
    \subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-a}}

    \subfloat[First subfigure]     {\includegraphics[height=4em,width=0.8\linewidth]{example-image-b}}

    \subfloat[First subfigure]     {\includegraphics[height=4em,width=0.8\linewidth]{example-image-c}}
    \caption{This is the third figure}
        &
    \subfloat[First subfigure] {\includegraphics[height=4em,width=0.8\linewidth]{example-image-a}}

    \subfloat[First subfigure]     {\includegraphics[height=4em,width=0.8\linewidth]{example-image-b}}

    \subfloat[First subfigure]     {\includegraphics[height=4em,width=0.8\linewidth]{example-image-c}}
    \caption{This is the forth figure}
  \end{tabularx}
\end{figure}
\end{document}

在此处输入图片描述

相关内容