[Tex/LaTex] Equal size subfigure

graphicsheightsubfloatstables

I want my subfigures to look uniform, thus each having same width and height.
Additionally, each of the two rows should have a center, around which all subfigures in that row are centered.

I want that to happen automatically without fiddling with height, width and scale parameters until everything fits.

My code:

\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}

sample output

Best Answer

Here is my suggested (even if bulky) answer. enter image description here

  • centering: It uses \minipages (since you already know it will be 3 rows and 2 colums) + \hfill, and \adjustboxes with valign=t,center option for centering the last one.
  • adequate size We use the trick given in Scale included graphics to the higher ratio instead of the lower for given width, height : using the keepaspectratio option of \includegraphics, combined with defining a (max) width and height (according to the ratio (a) to (e) pictures : I assumed here that they are 3/4 -- hence 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}