答案1
- 一种方法是将图像放在表格中,例如基于
tabularray
包,并在第一列和第一行写入有关图像的所需信息。 - 对于图像的垂直定位,您需要将图像基线移动到其垂直中心。为此,使用包是明智的
adjustbox
。——通过使用它,您还可以确定图像的常用设置。 - 为了旋转第一列中的文本,使用了包
rotating
和makecell
命令\rothead
:
\documentclass{article}
\usepackage[export]{adjustbox}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{tabularray}
\begin{document}
\begin{figure}[ht]
\settowidth\rotheadsize{merge}
\adjustboxset{width=\linewidth,valign=c}
\begin{tblr}{colsep=1pt,
colspec = {@{} Q[c,m] *{4}{X[c]} @{} },
cell{2-Z}{1} = {cmd=\rothead},
rowsep = 1pt
}
\centering
& 1:0 & 1000:1 & 100:1 & 10:1 \\
mCh
& \adjincludegraphics{example-image-a}
& \adjincludegraphics{example-image-b}
& \adjincludegraphics{example-image-c}
& \adjincludegraphics{example-image} \\
eGFP
& \adjincludegraphics{example-image-a}
& \adjincludegraphics{example-image-b}
& \adjincludegraphics{example-image-c}
& \adjincludegraphics{example-image} \\
merge
& \adjincludegraphics{example-image-a}
& \adjincludegraphics{example-image-b}
& \adjincludegraphics{example-image-c}
& \adjincludegraphics{example-image} \\
\end{tblr}
\caption{Caption for figure}
\label{fig:required}
\end{figure}
\end{document}
答案2
由于原帖的描述既没有标题也没有图号,我认为不需要标签或引用。因此,我将图像构建为一个简单的标签堆栈。行和列之间的垂直和水平间隙可以调整以适应。
\documentclass{article}
\usepackage{graphicx,tabstackengine,lipsum}
\setstacktabbedgap{3pt}
\begin{document}
\lipsum[3]
\bigskip\noindent\tabbedShortstack{
&1:0 & 1000:1 & 100:1 & 10:1\\
\rotatebox[origin=c]{90}{mCh\strut}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image}}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-a}}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-b}}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-c}}\\
\rotatebox[origin=c]{90}{eGFP\strut}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image}}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-a}}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-b}}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-c}}\\
\rotatebox[origin=c]{90}{merge\strut}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image}}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-a}}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-b}}&
\raisebox{-.45\height}{\includegraphics[width=.2\textwidth]{example-image-c}}
}\bigskip
\lipsum[2]
\end{document}
答案3
假设您的图像具有相同的比例,您可以制作一个tabular*
垂直居中的图像(使用内部的tabular
)。
我为这项工作定义了本地命令,以免混淆输入。
\documentclass{article}
\usepackage{graphicx}
\begin{document}
\begin{figure}[htp]
% local commands to ease input
\newcommand{\imagewidth}{\dimexpr(\columnwidth-\ht\strutbox-\dp\strutbox-12pt)/4\relax}
\newcommand{\addimage}[1]{%
\begin{tabular}{@{}c@{}}
\includegraphics[width=\imagewidth]{#1}
\end{tabular}%
}
\newcommand{\addlabel}[1]{%
\begin{tabular}{@{}c@{}}
\rotatebox{90}{#1\strut}
\end{tabular}%
}
% locally set \tabcolsep to zero
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\columnwidth}{@{}r@{\extracolsep{\fill}}cccc@{}}
& 1:0 & 1000:1 & 100:1 & 10:1 \\
\addlabel{mCh} &
\addimage{example-image} &
\addimage{example-image-a} &
\addimage{example-image-b} &
\addimage{example-image-c} \\
\addlabel{eGFP} &
\addimage{example-image} &
\addimage{example-image-a} &
\addimage{example-image-b} &
\addimage{example-image-c} \\
\addlabel{merge} &
\addimage{example-image} &
\addimage{example-image-a} &
\addimage{example-image-b} &
\addimage{example-image-c}
\end{tabular*}
\caption{This is a $3\times 4$ arrangement of figures}
\end{figure}
\end{document}