我想制作具有两个主列和 5 行的子图。每列本身将分为 3 个子列(总共是2*3=6
列和6*5=30
图像)。我还想为每列和每幅图添加标题。此外,我希望两个主列之间的距离大于子列之间的距离因此这表明它们指的是两个不同的类别。我可以使用以下方法获取除两个主列之间的距离之外的所有内容如何将 6 张图片放在 3 列 2 行中?。
我尝试使用两个subfigures
(一个在另一个里面),但没有用。非常感谢您的帮助!
答案1
以下解决方案将 15 个subfigure
环境分成两个minipage
环境。
\documentclass[demo]{article} % remove 'demo' option in real doc.
\usepackage{graphicx,subcaption,showframe} % don't load 'showframe' in real doc.
\begin{document}
\begin{figure}[p!]
% widths and heights of graphs
\setkeys{Gin}{width=\linewidth,height=0.145\textheight}
\caption*{A figure with 30 subfigures}
\begin{minipage}{0.48\textwidth}
\begin{subfigure}{0.32\linewidth}
\includegraphics{aa}
\caption*{aa}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{ab}
\caption*{ab}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{ac}
\caption*{ac}
\end{subfigure}
\medskip
\begin{subfigure}{0.32\linewidth}
\includegraphics{ad}
\caption*{ad}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{ae}
\caption*{ae}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{af}
\caption*{af}
\end{subfigure}
\medskip
\begin{subfigure}{0.32\linewidth}
\includegraphics{ag}
\caption*{ag}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{ah}
\caption*{ah}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{ai}
\caption*{ai}
\end{subfigure}
\medskip
\begin{subfigure}{0.32\linewidth}
\includegraphics{aj}
\caption*{aj}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{ak}
\caption*{ak}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{al}
\caption*{al}
\end{subfigure}
\medskip
\begin{subfigure}{0.32\linewidth}
\includegraphics{am}
\caption*{am}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{an}
\caption*{an}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{ao}
\caption*{ao}
\end{subfigure}
\end{minipage}\hfill
\begin{minipage}{0.48\textwidth}
\begin{subfigure}{0.32\linewidth}
\includegraphics{ba}
\caption*{ba}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{bb}
\caption*{bb}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{bc}
\caption*{bc}
\end{subfigure}
\medskip
\begin{subfigure}{0.32\linewidth}
\includegraphics{bd}
\caption*{bd}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{be}
\caption*{be}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{bf}
\caption*{bf}
\end{subfigure}
\medskip
\begin{subfigure}{0.32\linewidth}
\includegraphics{bg}
\caption*{bg}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{bh}
\caption*{bh}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{bi}
\caption*{bi}
\end{subfigure}
\medskip
\begin{subfigure}{0.32\linewidth}
\includegraphics{bj}
\caption*{bj}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{bk}
\caption*{bk}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{bl}
\caption*{bl}
\end{subfigure}
\medskip
\begin{subfigure}{0.32\linewidth}
\includegraphics{bm}
\caption*{bm}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{bn}
\caption*{bn}
\end{subfigure}\hfill
\begin{subfigure}{0.32\linewidth}
\includegraphics{bo}
\caption*{bo}
\end{subfigure}
\end{minipage}%
\end{figure}
\end{document}
附录回答 OP 的后续问题,即如何在六列subfigure
环境中放置一行标题。我能想到的一种方法是,minipage
在主\caption
指令之后创建一行环境,其宽度由后续subfigure
环境指定,然后\caption*
在每个环境中放置一个指令minipage
。例如,如下所示:
\begin{minipage}{0.1536\textwidth}% 0.48*0.32=0.1536
\caption*{aaaa}
\end{minipage}\hspace{0.0096\textwidth}% 0.0096=(0.48-3*0.1536)/2
\begin{minipage}{0.1536\textwidth}
\caption*{bbbb}
\end{minipage}\hspace{0.0096\textwidth}%
\begin{minipage}{0.1536\textwidth}
\caption*{cccc}
\end{minipage}\hspace{0.04\textwidth}% 0.04=1-2*0.48
\begin{minipage}{0.1536\textwidth}
\caption*{dddd}
\end{minipage}\hspace{0.0096\textwidth}%
\begin{minipage}{0.1536\textwidth}
\caption*{eeee}
\end{minipage}\hspace{0.0096\textwidth}%
\begin{minipage}{0.1536\textwidth}
\caption*{ffff}
\end{minipage}
您可能需要调整指令
\setkeys{Gin}{width=\linewidth,height=0.145\textheight}
到
\setkeys{Gin}{width=\linewidth,height=0.14\textheight}
因为新行的标题占据了一些空间,从而给图表留下了较少的(垂直)空间。