我有五张图片作为子图。所有图片大小相同。但是,第 1 行和第 2 行未垂直对齐。
如果可能的话,我想将 (a) 和 (d) 以及 (b) 和 (e) 对齐。这是生成当前看到的图像的代码:
\documentclass[11pt]{report}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\newcommand{\plotfunc}[3]{
\begin{subfigure}[t]{#3\textwidth}
\caption{#2}
\resizebox{1\linewidth}{!}{
\includegraphics{../Images/GloveOfDoom/RFIDTag_Testing_Other_s}
}
\end{subfigure}
}
\begin{figure}
\plotfunc{methods.a9a.0.64}{a9a}{0.3}
\plotfunc{methods.webspam.0.0025}{webspam}{0.3}
\plotfunc{methods.rcv1.0.000625}{rcv1}{0.3}
\plotfunc{methods.news20.0.000625}{news20}{0.3}
\plotfunc{methods.kddcup2010.0.01}{kddcup2010}{0.3}
\caption{Training Time of Factorization machine with a bias term and $\lambda=0.01\lambda_{best}$}
\label{fig:FMLambda-1func}
\end{figure}
\end{document}
答案1
添加一个空行来表示换行符(假设所有图像具有相同的尺寸),它们将对齐。
\documentclass[11pt]{report}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{subcaption}
\newcommand{\plotfunc}[3]{%
\begin{subfigure}[t]{#3\textwidth}
\caption{#2}
\includegraphics[width=\linewidth]{example-image}
\end{subfigure}
}
\begin{document}
\begin{figure}
\plotfunc{methods.a9a.0.64}{a9a}{0.3}
\plotfunc{methods.webspam.0.0025}{webspam}{0.3}
\plotfunc{methods.rcv1.0.000625}{rcv1}{0.3}
\plotfunc{methods.news20.0.000625}{news20}{0.3}
\plotfunc{methods.kddcup2010.0.01}{kddcup2010}{0.3}
\caption{Training Time of Factorization machine with a bias term and $\lambda=0.01\lambda_{best}$}
\label{fig:FMLambda-1func}
\end{figure}
\end{document}