我希望我的子图看起来统一,因此每个子图都具有相同的宽度和高度。此外,两行中的每一行都应该有一个中心,该行中的所有子图都围绕该中心居中。
我希望这能够自动发生,而无需摆弄高度、宽度和比例参数,直到一切都适合。
我的代码:
\documentclass{article}
\usepackage[abs]{overpic}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{siunitx}
\begin{document}
\iffalse
\begin{overpic}[grid,tics=10,width=\textwidth]{pictures/reflectors/whiteboard-back/frontal.jpg}
\end{overpic}
\vskip 1cm
\begin{overpic}[grid,tics=10,trim=20 10 20 0,width=\textwidth]{pictures/reflectors/whiteboard-back/frontal.jpg}
\end{overpic}
\vskip 1cm
\begin{overpic}[grid,tics=10,trim=20 10 20 0,clip,width=\textwidth]{pictures/reflectors/whiteboard-back/frontal.jpg}
\end{overpic}
\fi
\begin{figure}
\subfloat[\SI{30}{\degree} left]{\includegraphics[height=0.4\textwidth]{results/rp/glassdoor-aac-30deg_left_rp.pdf}} \qquad
\subfloat[\SI{30}{\degree} right]{\includegraphics[height=0.4\textwidth]{results/rp/glassdoor-aac-30deg_right_rp.pdf}} \qquad
\subfloat[\SI{60}{\degree} left]{\includegraphics[height=0.4\textwidth]{results/rp/glassdoor-aac-60deg_left_rp.pdf}} \qquad
\subfloat[\SI{60}{\degree} right]{\includegraphics[height=0.4\textwidth]{results/rp/glassdoor-aac-60deg_right_rp.pdf}} \qquad
\subfloat[\SI{90}{\degree}]{\includegraphics[height=0.4\textwidth]{results/rp/glass-door-90deg_rp.pdf}} \qquad
\subfloat[Measurement location]{\includegraphics[angle=-90,origin=c,height=0.4\textwidth]{pictures/reflectors/glassdoor/frontal.jpg}} \qquad
\caption{Range measurements for clear glass at 30,60,90 degree angles of incidence from the left and the right side}
\label{fig:rp_glassdoor}
\end{figure}
\end{document}
答案1
- 定心:它使用
\minipages
(因为您已经知道它将有 3 行 2 列) +\hfill
,并\adjustbox
使用 esvalign=t,center
选项将最后一个居中。 - 足够大小我们使用根据给定的宽度和高度,将包含的图形缩放到更高的比例,而不是更低的比例:使用
keepaspectratio
选项\includegraphics
,结合定义(最大)width
和height
(根据(a)与(e)图片的比例:我在这里假设它们是 3/4 -- 因此width = 0.75\textwidth
)
\documentclass{article}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{siunitx}
\usepackage{adjustbox}
\begin{document}
\begin{figure}
\begin{minipage}[c]{\textwidth}
\begin{minipage}[t]{0.4\textwidth}
\centering
\subfloat[\SI{30}{\degree} left]{\includegraphics[height=\textwidth]{example-image-a}}
\end{minipage}
\hfill
\begin{minipage}[t]{0.4\textwidth}
\centering
\subfloat[\SI{30}{\degree} right]{\includegraphics[height=\textwidth]{example-image-a}}
\end{minipage}
\end{minipage}
\begin{minipage}[c]{\textwidth}
\begin{minipage}[t]{0.4\textwidth}
\centering
\subfloat[\SI{60}{\degree} left]{\includegraphics[height=\textwidth]{example-image-a}}
\end{minipage}
\hfill
\begin{minipage}[t]{0.4\textwidth}
\centering
\subfloat[\SI{60}{\degree} right]{\includegraphics[height=\textwidth]{example-image-a}}
\end{minipage}
\end{minipage}
\begin{minipage}[c]{\textwidth}
\adjustbox{valign=t}{
\begin{minipage}[t]{0.4\textwidth}
\centering
\subfloat[\SI{90}{\degree}]{\includegraphics[height=\textwidth]{example-image-a}}
\end{minipage}
}
\adjustbox{valign=t, center}{
\begin{minipage}{0.4\textwidth}%
\subfloat[Measurement location]{\includegraphics[angle=-90, origin=c, height=\textwidth, width = 0.75\textwidth, keepaspectratio]{example-image-b}}%
\end{minipage}
}
\end{minipage}
\caption{Range measurements for clear glass at 30,60,90 degree angles of incidence from the left and the right side}
\label{fig:rp_glassdoor}
\end{figure}
\end{document}
答案2
这是一个更简单的解决方案。我使用 \tempheight 来均衡高度,使用 \raisebox 来对齐底部。唯一需要调整的是适合页面。
\documentclass{article}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{showframe}% check centering
\newlength{\tempheight}
\begin{document}
\begin{figure}
\settoheight{\tempheight}{\includegraphics[width=0.4\textwidth]{example-image-a}}
\hfil\begin{tabular}{cc}
\includegraphics[width=0.4\textwidth]{example-image-a} &
\includegraphics[width=0.4\textwidth]{example-image-a} \\
\SI{30}{\degree} left & \SI{30}{\degree} right \\[1ex]
\includegraphics[width=0.4\textwidth]{example-image-a} &
\includegraphics[width=0.4\textwidth]{example-image-a} \\
\SI{60}{\degree} left & \SI{60}{\degree} right \\[1ex]
\includegraphics[width=0.4\textwidth]{example-image-a} &
\raisebox{\depth}{\includegraphics[width=\tempheight, angle=-90]{example-image-b}} \\
\SI{90}{\degree} & Measurement location
\end{tabular}
\caption{Range measurements for clear glass at 30,60,90 degree angles of incidence from the left and the right side}
\label{fig:rp_glassdoor}
\end{figure}
\end{document}