[Tex/LaTex] Two images are not on the same level

graphicshorizontal alignmentvertical alignment

I am using the following code to put two figures next to each other (I am not providing a minimal example right away, because maybe the problem is obvious from the code. However, I will, if someone needs one!):

\begin{figure}[h]
\begin{minipage}[h]{0.5\linewidth}
\centering
\includegraphics[width=\linewidth]{pdfexp.png}
\caption{Dichte der Exponential-Verteilung für  $a=0.5,\ \frac{1}{3},\ \frac{1}{5},\ \frac{1}{1000}.$}
\end{minipage}
\hspace{0.5cm}
\begin{minipage}[h]{0.5\linewidth}
\centering
\includegraphics[width=\linewidth]{cdfexp.png}
\caption{Verteilungsfunktion der Exponential-Verteilung für $a=0.5,\ \frac{1}{3},\ \frac{1}{5},\ \frac{1}{1000}$.}
\end{minipage}
\end{figure}

This produces:

Image

The images are of the same size, but the axes are not at the same base level. The axes from the right figure are put higher than the ones of the left figure. Why is this happening?

Best Answer

There is no [h] option for minipage. You should use [t] (top) to align both minipages to the baselines of their first lines, which are the images. The misalignment happens because the one caption is higher and the minipages are center-aligned be default. The unknown [h] option is silently ignored, but might break the alignment altogether.

Another thing is that you have 2x 0.5\linewidth plus \hspace{0.5cm} which is of course to wide. I would recommend to use 0.49\linewidth and \hfill instead.