Putting a set of subfigures of different size and shape side by side, top down, vertically aligned by the subcaption

Putting a set of subfigures of different size and shape side by side, top down, vertically aligned by the subcaption

I want to place four diferent images, two above, two below, as in a matrix, aligned by the subcaption. I have used the \subfigure environment but the images are in disarray.

\begin{figure}%
        \centering
        \subfigure[][]{
            \label{fig:A}
            \includegraphics[height=5.4cm]{ImageA}
        }
        \hspace{1cm}
        \subfigure[][]{
            \label{fig:B}
            \includegraphics[height=5cm]{ImageB}
        }\\
        \subfigure[][]{
            \label{fig:C}
            \includegraphics[height=3.65cm]{ImageC}
        }
        \hspace{95pt}
        \subfigure[][]{
            \label{fig:D}
            \includegraphics[height=3.65cm]{ImageD}
        }
        \hspace{20pt}
        \caption[Set of four subfigures.]{Set of four subfigures:
            \subref{fig:A} first subfigure;
            \subref{fig:B} second subfigure;
            \subref{fig:C} third subfigure; and,
            \subref{fig:D} last subfigure.}%
        \label{fig:Figure}%
    \end{figure}

답변1

  • your code use obsolete package subfigure. instead it is better use subfloats[]{...} from it supersede subfig (see code snippet below)
  • replace all fixed distances between sub figures with \hfill

with this changes you will get:

enter image description here

\begin{figure}[htb]
    \centering
    \subfloat[]{ % <---
        \label{fig:A}
        \includegraphics[height=5.4cm]{ImageA}
    }
    \hfil
    \subfloat[]{ % <---
        \label{fig:B}
        \includegraphics[height=5cm]{ImageB}
    }

    \subfloat[]{ % <---
        \label{fig:C}
        \includegraphics[height=3.65cm]{ImageC}
    }
    \hfil
    \subfloat[]{ % <---
        \label{fig:D}
        \includegraphics[height=3.65cm]{ImageD}
    }
    \caption[Set of four subfigures.]{Set of four subfigures:
        \subref{fig:A} first subfigure;
        \subref{fig:B} second subfigure;
        \subref{fig:C} third subfigure; and,
        \subref{fig:D} last subfigure.}%
    \label{fig:Figure}%
\end{figure}

관련 정보