How to display side-by-side figures in LaTeX

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.

\subfigure{\includegraphics[width=3in]{fig2.pdf} }}
\caption{Text pertaining to both graphs ...} \label{fig12}

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...
Tagged with:
Posted in Typography
31 comments on “How to display side-by-side figures in LaTeX
  1. jerry says:

    awesome tip, john. very helpful.

    i think there is a small bug (one bracket is missing).

    subfigure{includegraphics[width=3in]{fig2.pdf} }}}
    caption{Text pertaining to both graphs …}

  2. Michael says:

    Thanks for the tip! It works flawlessly. Smiling! :) Smiling!

  3. Steve says:

    Just what I needed. Thanks!

  4. kerimcan says:

    thanks for this post. very useful.

  5. mahyar says:

    thanks, but how can i write two different captions for the two figures while i put them side by side?

  6. Claudine Allen says:

    Thanks. This was way helpfule for me. To get the caption to work for each subfigure do this

    mbox{subfigure[Caption for Subfig1]{includegraphics[width=3in]{contextmodel}}quad
    subfigure[Caption for Subfig2]{includegraphics[width=3.5in]{contextmodel2}}}

  7. Alexandra says:

    Many thanks. Very useful. I need it.

  8. ran2 says:

    Thx John,
    this is great, since it does work with Sweave. I had some serious trouble to get minipage to work with Sweave (see here) . Btw if you don’t use Sweave, minipage is also a nice way to place graphs or tables next to each other. You can also use seperate captions then.

  9. Torbjorn says:

    The subfigure package is outdated, subfig should be used instead (according to subfigures page on CTAN).

  10. Matt Pillar says:

    Thanks for the post, worked great. I like to use a percentage of the text width as opposed to an absolute width in case I change the layout of the page.

    caption{Text pertaining to both graphs …}

  11. Elmano says:

    Thanks for this tip. It helped me!

  12. suvam says:

    Thanks!!!! It worked!!

  13. Jayaram Sethuraman says:

    Very useful. Thanks for posting this.

  14. Very nice, but if you want two real figures side by side, you can also write something like this:


  15. There is also package called floatrow. Not anly allows placing various floats side-by-side but also adds great functionality to manage captions. With extensive documentation.

  16. Bogdan says:

    Awesome tip. Worked like a charm.


  17. Muhammad Azeem Abbas says:

    Thanks, it works fine. (I am using it in Springer One Column Documents).

  18. cmdline says:

    mbox worked like a charm :)

  19. prateek says:

    thanks, it has helped me
    but i am stucked because it is giving errors when using with hyperref

  20. Ibra says:

    Salut à tous, j’ai fini mn rapport de stage mais on me demande metre le numero de mon rapport sur la 1ere page et à gauche. J’ai tout fais mais je n’arrive pas à le metre à gauche. Aidez-moi.

    [English translation via Google: Hi all, I ended mn placement report but wonder meter the number of my report on the first page and left. I do everything but I can not seem to meter on the left. Please help me.]

  21. Abhiram Soori says:

    Thanks a lot!
    This post helped me.

  22. Iftikhar Ali says:

    Thanks alot. Now I can include figures in my tex files.

  23. Human_translation. says:

    Ibra translation from french,

    Hello to all,

    I have finished my training report but I was asked to write my report number on the left of the first page. I did everything but I am not able to write it on the left.
    Can you help please

  24. Dileep kumar says:

    Very thanq :). Want to correct Andi and Matt. The width is not 0.4textwidth , but it is 0.4linewidth

  25. uday says:

    Thanks its helpful!!

  26. Soroush says:

    I believe it is also possible to put two figures side by side by defining two columns

  27. tom says:


    The subfigure package is not maintained. I’d recommend using either the subcaption or the subfig package.

  28. Sumanta Sidui says:

    Thank’s for the help.

  29. Kim says:


    as you may have noticed from the amount of “thanks” comments, any article explaining succintly how to do something in LaTeX (that gets Google’s first page) is a lifesaver for thousands as me. I guess many (as me!) didn’t think it was a worthy “just-in-case” skill, and when faced with the need to use it have to default to “just-in-time”, copy-pasting commands until it works.

    Anyway, thanks as well, and keep posting drops of LaTeX hacking/wisdom.

  30. Guohua Liang says:

    Thanks. It is great. Save me a lot of time.

  31. Umit says:

    Thank you! Saved the day.