如何为子图创建垂直方向的“行名”?我试图在这里形象化我的想法:
以下是使用 subcaption 包在更大的图形环境中获取子图的图像代码:
\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}
\pagestyle{empty}
\begin{document}
\begin{figure}[ht]
\begin{subfigure}[b]{0.5\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-a}
\vspace{4ex}
\end{subfigure}%%
\begin{subfigure}[b]{0.5\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-a}
\vspace{4ex}
\end{subfigure}
\begin{subfigure}[b]{0.5\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-b}
\vspace{4ex}
\end{subfigure}%%
\begin{subfigure}[b]{0.5\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-b}
\vspace{4ex}
\end{subfigure}%%
\caption{Illustration of various images}
\label{fig7}
\end{figure}
\end{document}
答案1
三个选项:
使用
tabular*
宽度等于\textwidth
和m{<length>}
列的。使用
adjustbox
包裹。将其中一张图片装箱来测量其高度(假设所有四张图像具有相同的高度)。
在这三种情况下,标签都放置在 内\rotatebox
。代码如下:
\documentclass{article}
\usepackage[paperheight=35cm,vmargin=2cm]{geometry}% just for the example
\usepackage{graphicx}
\usepackage{subcaption}
\usepackage{adjustbox}
\usepackage{array}
\pagestyle{empty}
% Measure the image height
\newsavebox\mybox
\savebox\mybox{%
\begin{minipage}[t]{0.48\linewidth}
\includegraphics[width=0.75\linewidth]{example-image-a}
\end{minipage}%
}
\newlength\ImageHt
\setlength\ImageHt{\ht\mybox}
\begin{document}
\begin{figure}[!t]
\begin{tabular*}{\textwidth}{
@{}m{0.5cm}
@{}m{\dimexpr0.5\textwidth-0.25cm\relax}
@{}m{\dimexpr0.5\textwidth-0.25cm\relax}
@{}}
\rotatebox{90}{row number 1}
& \begin{subfigure}[b]{\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-a}
\end{subfigure}
& \begin{subfigure}[b]{\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-a}
\end{subfigure} \\
\rotatebox{90}{row number 2}
& \begin{subfigure}[b]{\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-b}
\end{subfigure}
& \begin{subfigure}[b]{\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-b}
\end{subfigure}
\end{tabular*}
\caption{Illustration of various images}
\label{fig7}
\end{figure}
\begin{figure}[!ht]
\rotatebox[origin=c]{90}{\makebox[\ImageHt]{row number 1}}%
\begin{subfigure}{0.48\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-a}
\end{subfigure}%%
\begin{subfigure}{0.48\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-a}
\end{subfigure}\par\bigskip
\rotatebox[origin=c]{90}{\makebox[\ImageHt]{row number 2}}%
\begin{subfigure}{0.48\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-b}
\end{subfigure}%%
\begin{subfigure}{0.48\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-b}
\end{subfigure}%%
\caption{Illustration of various images}
\label{fig8}
\end{figure}
\begin{figure}[!b]
\rotatebox[origin=c]{90}{\makebox[\ImageHt]{row number 1}}%
\begin{subfigure}{0.48\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-a}
\end{subfigure}%%
\begin{subfigure}{0.48\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-a}
\end{subfigure}\par\bigskip
\rotatebox[origin=c]{90}{\makebox[\ImageHt]{row number 2}}%
\begin{subfigure}{0.48\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-b}
\end{subfigure}%%
\begin{subfigure}{0.48\linewidth}
\centering
\includegraphics[width=0.75\linewidth]{example-image-b}
\end{subfigure}%%
\caption{Illustration of various images}
\label{fig8}
\end{figure}
\end{document}
结果: