place multiple images on one line in latex (or even create a matrix of images)
May 16th, 2006 by Lawrence David
to tile images in a figure, use the following code:
\begin{figure}[h]
\begin{center}$
\begin{array}{cc}
\includegraphics[width=2.5in]{image1.jpg} &
\includegraphics[width=2.5in]{image2.jpg}
\end{array}$
\end{center}
\caption{my caption}
\end{figure}
to place more than 2 images on a line, add extra ‘c’s to the {array} specification and follow each \includegraphics[]{} with an ampersand (&). to create a matrix of images, insert newlines using two slashes: for instance, to make a 2X2 matrix of images:
\begin{figure}[h]
\begin{center}$
\begin{array}{cc}
\includegraphics[width=2.5in]{image1.jpg} &
\includegraphics[width=2.5in]{image2.jpg} \\ \includegraphics[width=2.5in]{image1.jpg} &
\includegraphics[width=2.5in]{image2.jpg}
\end{array}$
\end{center}
\caption{my caption}
\end{figure}
Hey man, good website with very useful information on latex.
Good luck with your PhD in MIT.
Bidur Khanal
Research student
University if southampton, UK
Hello Man,
Thanks for the nice code.
All the best.
Charles
You mention it in the main text of your message, but it is not in the code – that you need two slashes (\), code only has one
Works great then.
thanks for catching that – i’ve updated the code!
Why don’t you use the tabular environment? It works just like array, but it doesn’t need to be in math mode (i.e. no surrounding dollars).
Also, try the subfig package: http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=subfig
its 30°C in my office. i finish this report or it finishes me. thanx for the code.
Great one thank you. It really eased my pain.
I wonder if there is some code for placing images like:
[image]
[image] [image]
I could not make this by playing with your code.
Reply to myself for three images: one centered on top, the two below, again centered:
\begin{figure}[H]
\begin{center}
\subfloat{\includegraphics[width=2cm]{image1.png}} \\
\subfloat{\includegraphics[width=2cm]{image2.png}}
\subfloat{\includegraphics[width=2cm]{image3.png}}
\end{center}
\end{figure}
thanks tolga, i didn’t know that!
How a bout this ?
[image] [ one ]
big
[image] [ image ]
couldn’t do it at all
Thanks Lawrence and the other commenters. This is a great tip.
Hello sir,
Do you know how to put two figures top-down tightly, without any space between them. I tried several different method. The array method mention here
get the large space between the two figures.
Many thanks!
\begin{figure}[h]
\begin{center}$
\begin{array}{c}
\includegraphics[width=2.5in]{64_1_2.eps} \\
\includegraphics[width=2.5in]{64_1_2.eps}
\end{array}$
\end{center}
\caption{my caption}
\end{figure}
Great tip! I’ve always wanted to know how to combine multiple images into one figure – no more minipage then
hi
bardlpm2r07q0uct
good luck
thx 4 the help. first time using latex. ISBI ’09 paper due jan 19
The subfigure package is also good for this purpose. One plus side is that you can add captions for the subfigures, as well.
Still very useful tip, though!
Thank you so much for this site!! I have been forever trying to figure out how to insert 2×2 matrices in LaTeX!!
Excellent tip. I just have a doubt. Is it possible with this method to put a caption for each image in addition to the caption of the matrix??
Thanks
Thanks for sharing this great snippet of code. It worked as advertised. I had some trouble getting it to use .jpg image but, it was okay with a .eps image.
Thanks!
Thanks, your tip solved my problem.
Now I want to put captions to the images, Is it possible to put caption to each image seperately.
Great, exactly what I want, a 2×2 figure matrix! Cheers!
How can I place certain capture for each image?
oops, I mean caption)
thanx a lot.
Seyab Khan
Thanks, your tip solved my problem.
Now I want to put captions to the images, Is it possible to put caption to each image seperately.
————————
its also my problem. does anybody know?
if you use the subfig package, it gets easy. just do like this:
\usepackage{subfig}
…
\begin{figure}
\centering
\subfloat[Part 1][Subfigure 1]{\includegraphics{image1.jpg} \label{fig:fourfigures-a}}
\subfloat[Part 2][Subfigure 2]{\includegraphics{image2.jpg} \label{fig:fourfigures-b}}\\
\subfloat[Part 3][Subfigure 3]{\includegraphics{image3.jpg} \label{fig:fourfigures-c}}
\subfloat[Part 4][Subfigure 4]{\includegraphics{image4.jpg} \label{fig:fourfigures-d}}
\caption{Four figures}
\label{fig:fourfigures}
\end{figure}
the [Part x] option is the subfigure caption in the figure list, and can be ommitted. The [Subfigure x] is the subfigure caption on the page itself. Subfigures will be “numbered” (a), (b), (c), etc unless the caption is ommitted completely. The manual will show you a bunch of other neat tricks.
Thanks, Very useful and nice codes.
Thanks! Very useful code, it solved my problem easily and in an elegant way.
Many thanks!
Regards from Cambridge/UK
Thanks, this was really helpful. I have now been able to get some horizontal space between my 2 figures using subfloat.
thanks man!
Hi, I want to place a table and and an image on the same line.
Thankx for Your reponse
Thanks a lot! Saved me tonnes of time searching for this option!
thanks! that helped me a lot!
Great!
Thanks a lot!!!
Don’t use the \begin{center} environment in a figure, it adds extra vertical space which is not needed and doesn’t look good. Instead, use \centering.
Cheers
Hi,
I am using the following to include four figures in one page:
\begin{figure}[h]
\begin{center}$
\begin{array}{cc}
\includegraphics[width=2.5in]{image1.jpg} &
\includegraphics[width=2.5in]{image2.jpg} \\ \includegraphics[width=2.5in]{image1.jpg} &
\includegraphics[width=2.5in]{image2.jpg}
\end{array}$
\end{center}
\caption{my caption}
\end{figure}
I found it very easy, however I have a problem which is; how could I label each figure separately. I mean, the first figure (top left), the second (top right) and so on.
Thanks very much for your help.
Hi,
I am using the following to include four figures in one page:
\begin{figure}[h]
\begin{center}$
\begin{array}{cc}
\includegraphics[width=2.5in]{image1.jpg} &
\includegraphics[width=2.5in]{image2.jpg} \\ \includegraphics[width=2.5in]{image1.jpg} &
\includegraphics[width=2.5in]{image2.jpg}
\end{array}$
\end{center}
\caption{my caption}
\end{figure}
I found it very easy, however I have a problem which is; how could I label each figure separately. I mean, if i have 10 figures in an array i want to label each of them seperately
e.g. (a)tiger (b)bird and so on
please help
Hi,
I would like to insert multiples images at once in Latex. I was thinking of using ‘for’ loops. Is it possible? Kindly advise me on this issue.
Thank You.
Thank you very much..you solved my problem quickly
I think on 18 Jul 2011 someone trolled this comment section
Dude, that just worked like magic! Now I arrange pictures efficiently to save paper.
Thanks Buddy!
Hey guys,
Do you happen to know how I can make two pictures show up in latex as follows:
one picture normal size with second picture to appear as a small insert covering the top right corner of the first picture. The second pic is a zoom in at a part of the first pic.
I have no idea how to do this.. These are both matlab .eps files so if you know of any way that I could do it in matlab instead it would also be helpful. Thank you!
Best,
s~
Haha, who would have thought my old GRT will help me with LaTeX I miss you guys!
Hi,
Can any one tell me that how zoomed figure could be included in main figure window
Thanks for the useful post. It works fine.
Great Stuff. You helped me a lot.
Andy
Hi,
This refers to placing multiple images side by side or in array in Latex. If the images are not the same size the effect can be ugly.
I use a mathematical graphing program to, yep, draw graphs and then a drawing program to make my own graphics. The two images are rarely close to the same shape and size.
Sometimes one can juggle the “width=” parameters. I find that other times I need to use Windows Paint.exe to resize an image and then, if it was a reduction, to crop away the white space using select, cut, new, reduce the canvass so that paste will fill it then save with an appropriate name.
I hope that this helps someone.
Andy