子图网格,左侧每行一个标题

子图网格,左侧每行一个标题

figure我可以使用和实现以下目标table

在此处输入图片描述

使用一些多行对齐,我可以将“标题”(实际上是文本)对齐到中心:

在此处输入图片描述

但是我希望能够使用 来引用每一行\ref,因此我需要将每一行作为一个子图,并在左侧添加标题,但不添加“图”字样。
如何实现?

这是我迄今为止使用的代码,使用表格:

\begin{figure}[ht]
\centering
\par%
\begin{tabular}{ccc}
& RGB & NIR\\
(a) & \includegraphics[width=.3\linewidth]{whatever.jpg} & \includegraphics[width=.3\linewidth]{whatever.jpg}\\
(b) & \includegraphics[width=.3\linewidth]{whatever.jpg} & \includegraphics[width=.3\linewidth]{whatever.jpg}\\
(c) & \includegraphics[width=.3\linewidth]{whatever.jpg} & \includegraphics[width=.3\linewidth]{whatever.jpg}\\
(d) & \includegraphics[width=.3\linewidth]{whatever.jpg} & \includegraphics[width=.3\linewidth]{whatever.jpg}\\
\end{tabular}
\caption{some caption}.}%
\label{fig:fig1}%
\end{figure}

我还设法绘制了子图,但标题出现在底部。

答案1

下面的示例代码应该可以帮助您入门。

在此处输入图片描述

\documentclass{article}
\usepackage{array,booktabs}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}} % w/ horizontal centering
\usepackage{subcaption} % for 'subfigure' environment
\usepackage[demo]{graphicx}

\begin{document}
\begin{figure}[ht!]
\setlength\tabcolsep{3pt} % default: 6pt
\centering
\begin{tabular}{@{} r M{0.3\linewidth} M{0.3\linewidth} @{}}
& RGB & NIR\\
\begin{subfigure}{0.05\linewidth} \caption{}\label{subfig:a} \end{subfigure} 
  & \includegraphics[width=\hsize]{whatever.jpg} 
  & \includegraphics[width=\hsize]{whatever.jpg}\\ \addlinespace
\begin{subfigure}{0.05\linewidth} \caption{}\label{subfig:b} \end{subfigure} 
  & \includegraphics[width=\hsize]{whatever.jpg}    
  & \includegraphics[width=\hsize]{whatever.jpg}\\ \addlinespace
\begin{subfigure}{0.05\linewidth} \caption{}\label{subfig:c} \end{subfigure} 
  & \includegraphics[width=\hsize]{whatever.jpg} 
  & \includegraphics[width=\hsize]{whatever.jpg}\\ \addlinespace
\begin{subfigure}{0.05\linewidth} \caption{}\label{subfig:d} \end{subfigure} 
  & \includegraphics[width=\hsize]{whatever.jpg} 
  & \includegraphics[width=\hsize]{whatever.jpg}\\
\end{tabular}
\caption{Four rows of graphs}
\label{fig:fig1}
\end{figure}

\noindent
Cross-references to subfigures \ref{subfig:a} and \ref{subfig:d}.
\end{document}

答案2

最初的想法是在第一列中使用\subcaption,但它的基线在顶部,导致垂直对齐困难。是的,您可以\label使用\tabcaption

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}% or \newcounter{subfigure}[figure]
\usepackage{duckuments}% just for fun
\usepackage{array}

\newcolumntype{v}{>{\sbox0\bgroup}c<{\egroup\raisebox{\dimexpr 0.5\dp0-0.5\ht0}%
 [\dimexpr 0.5\ht0-0.5\dp0+1pt][\dimexpr 0.5\ht0-0.5\dp0+1pt]{\usebox0}}}

\newcommand{\tabcaption}{\refstepcounter{subfigure}(\thesubfigure)}

\begin{document}

\begin{figure}[ht]
\centering

\begin{tabular}{vvv}
& RGB & NIR\\
\tabcaption & \includegraphics[width=.3\linewidth]{example-image-duck}
            & \includegraphics[width=.3\linewidth]{example-image-duck}\\
\tabcaption & \includegraphics[width=.3\linewidth]{example-image-duck}
            & \includegraphics[width=.3\linewidth]{example-image-duck}\\
\tabcaption & \includegraphics[width=.3\linewidth]{example-image-duck}
            & \includegraphics[width=.3\linewidth]{example-image-duck}\\
\tabcaption & \includegraphics[width=.3\linewidth]{example-image-duck}
            & \includegraphics[width=.3\linewidth]{example-image-duck}
\end{tabular}
\caption{some caption}% note: \caption begins and ends with a \par
\label{fig:fig1}
\end{figure}

\end{document}

演示

答案3

使用floatrowsubfig包:

\documentclass{article}
\usepackage{graphicx}
\usepackage{floatrow}
\usepackage[label font=bf, labelformat=simple]{subfig}
\floatsetup[figure]{style=plain,subcapbesideposition=center}

\begin{document}
%---------------------------------------------------------------%
    \begin{figure}
    \centering
\setkeys{Gin}{width=0.45\textwidth}
    \quad\parbox{0.45\linewidth}{\hfil RGB} \parbox{0.45\linewidth}{\hfil NIR}  
    
    \smallskip 
\sidesubfloat[\label{fig:a}]%
    {\includegraphics{example-image-duck}
        \hfil
     \includegraphics{example-image-duck}
    }

\medskip
\sidesubfloat[\label{fig:b}]%
    {\includegraphics{example-image-duck}
        \hfil
     \includegraphics{example-image-duck}
    }

\medskip
\sidesubfloat[\label{fig:b}]%
    {\includegraphics{example-image-duck}
        \hfil
     \includegraphics{example-image-duck}
    }
    \caption{main caption}
\label{fig:myfigure}
    \end{figure}
\end{document}

在此处输入图片描述

相关内容