2

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

Torbjørn T.
  • 206,688
cschmol
  • 79
  • Welcome to TeX.SX! For your subfigure (f): do you intend to crop it, or to "deform" it? (I don't think the latter would suit your needs). If all your subfigures don't have the same ratio, it will be hard to define one rule for all... – ebosi Apr 18 '16 at 14:19
  • I would like the subfigure with the photo to take the height of the graphs. If it were in landscape mode, I would like it to take the width of the graphs. On addition to that it should be centered, e.g. in this case the centre of the image should be underneath the marker "5" in the above plot. – cschmol Apr 18 '16 at 14:53

2 Answers2

4

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}
ebosi
  • 11,692
1

Here is a simpler solution. I used \tempheight to equalize the heights and \raisebox to align the bottoms. The only adjustment needed is to fit the page.

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

demo

John Kormylo
  • 79,712
  • 3
  • 50
  • 120