The other day I tried putting two graphs side-by-side by setting R’s mfrow parameter. That made the graphs look odd because not everything was scaled proportionately. Then someone told me I could use a LaTeX command to place my original graphs side-by-side rather than creating a new image.
The trick is to use the subfigure package. Include the directive \usepackage{subfigure} at the top of your file, then use code something like the following.
\begin{figure}
\centering
\mbox{\subfigure{\includegraphics[width=3in]{fig1.pdf}}\quad
\subfigure{\includegraphics[width=3in]{fig2.pdf} }}
\caption{Text pertaining to both graphs ...} \label{fig12}
\end{figure}
If you put text in square brackets immediately after the \subfigure command, that text will be a caption for the corresponding sub-figure. For example, the LaTeX code above might be changed to include the following.
...\subfigure[Description of left graph]{\includegraphics...

{ 5 comments… read them below or add one }
jerry 02.26.09 at 13:08
awesome tip, john. very helpful.
i think there is a small bug (one bracket is missing).
\begin{figure}
\centering
\mbox{\subfigure{\includegraphics[width=3in]{fig1.pdf}
\quad
\subfigure{\includegraphics[width=3in]{fig2.pdf} }}}
\caption{Text pertaining to both graphs …}
\label{fig12}
\end{figure}
Michael 04.28.09 at 10:04
Thanks for the tip! It works flawlessly. Smiling!
Smiling!
Steve 10.09.09 at 07:22
Just what I needed. Thanks!
kerimcan 11.19.09 at 15:05
thanks for this post. very useful.
mahyar 03.02.10 at 03:27
thanks, but how can i write two different captions for the two figures while i put them side by side?