我想生成一个图表。一个很好的例子是如何生成图表目录我已经完成了,但是现在我想在每个图 (a)、(b) 下添加标签……以便我在文本中引用它们。这可以通过以下方式实现在 Latex 中插入多个图形但是,在我的例子中,我希望 x 标签和 y 标签都存在(如下图所示)。此外,我希望 y 轴标签旋转 90 度。
答案1
表格取自已接受的答案这里:
您需要\usepackage{caption}
并可以使用\caption*{...}
\documentclass[a4paper,10pt]{article}
\usepackage{array}
\usepackage{booktabs}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz}
\usepackage{caption}
\newcommand{\dummyfigure}{\tikz \fill [NavyBlue] (0,0) rectangle node [black] {Figure} (2,2);}
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\begin{table}
\centering
\begin{tabular}{cM{20mm}M{20mm}M{20mm}M{20mm}}
\toprule
Nr. & Case 1 & Case 2 & Case 3 & Case 4 \\
\midrule
\rotatebox[origin=c]{90}{Parameter 1} & \dummyfigure \caption*{(a)}\label{a} & \dummyfigure \caption*{(b)}\label{b} & \dummyfigure \caption*{(c)}\label{c}& \dummyfigure \caption*{(d)}\label{d}\\
\rotatebox[origin=c]{90}{Parameter 2} & \dummyfigure \caption*{(e)}\label{e} & \dummyfigure \caption*{(f)}\label{f} & \dummyfigure \caption*{(g)}\label{g} & \dummyfigure \caption*{(h)}\label{h} \\
\rotatebox[origin=c]{90}{Parameter 3} & \dummyfigure \caption*{(i)}\label{i} & \dummyfigure \caption*{(j)}\label{j} & \dummyfigure \caption*{(k)}\label{k} & \dummyfigure \caption*{(l)}\label{l}\\
\bottomrule
\end{tabular}
\caption{Table of figures}
\label{tbl:table_of_figures}
\end{table}
\end{document}
答案2
对于子标题,您可以使用或 2.3 版包中subfloat
定义的环境。对于第一行的内容旋转,可以使用和包,对于表格,使用 (新)包很方便。subfig
subcaption
rotating
makecell
tabularray
example-image-duck
在 MWE 中,包中提供的图像如下graphicx
:
\documentclass[a4paper]{article}
\usepackage{caption}
\usepackage{subcaption} % version 1.3
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{rotating}
\usepackage{makecell}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, counter, varwidth}
\begin{document}
\begin{table}
\centering
\setkeys{Gin}{width=\linewidth}
\settowidth\rotheadsize{PARAMETERS 3} % from makecell
\begin{tblr}{colspec = { Q[h] *{4}{Q[c,m, wd=35mm]}},
colsep = 3pt,
cell{2-Z}{1} = {cmd=\rotcell, font=\footnotesize\bfseries},
row{1} = {font=\bfseries},
measure=vbox
}
\toprule
Nr. & Case 1 & Case 2 & Case 3 & Case 4 \\
\midrule
PARAMETERS 1
& \subfloat[]{\includegraphics{example-image-duck}}
& \subfloat[]{\includegraphics{example-image-duck}}
& \subfloat[]{\includegraphics{example-image-duck}}
& \subfloat[]{\includegraphics{example-image-duck}} \\
PARAMETERS 2
& \subfloat[]{\includegraphics{example-image-duck}}
& \subfloat[]{\includegraphics{example-image-duck}}
& \subfloat[]{\includegraphics{example-image-duck}}
& \subfloat[]{\includegraphics{example-image-duck}} \\
PARAMETERS 3
& \subfloat[]{\includegraphics{example-image-duck}}
& \subfloat[]{\includegraphics{example-image-duck}}
& \subfloat[]{\includegraphics{example-image-duck}}
& \subfloat[]{\includegraphics{example-image-duck}} \\
\bottomrule
\end{tblr}
\caption{Table of figures}
\label{tbl:table_of_figures}
\end{table}
\end{document}