Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

This question already has an answer here:

I would like to know how can I put two diagrams on the same like rather than one of the top and one at the bottom. which consumed too much space on the paper. Here are the codes for the figure which I used.

  \begin{figure}[!htb]\centering
     \frame{\includegraphics[width=10cm]{Data1}}
     \caption{Interpolation for Data 1}
  \label{Fig:Data1}
  \end{figure}

  \begin{figure}[!htb]\centering
     \frame{\includegraphics[width=10cm]{Data2}}
     \caption{Interpolation for Data 2}
  \label{Fig:Data2}
  \end{figure}
share|improve this question

marked as duplicate by cmhughes, egreg, Werner, Speravir, Kurt Apr 5 '13 at 3:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
I think that is difficult since the width of the images are 10cm each, meaning it is wider than the page width, or are you using landscape? –  xfoo Jan 9 '13 at 8:33
    
You have to make subfigures with the 'subfig' package. Please see the answer to (tex.stackexchange.com/questions/83664/inserting-subfigures) –  zunbeltz Jan 9 '13 at 8:33
    
@ChristianR. - What width do you think I should put for both to fit on the same line? I have been working on two graph whereby the second is a replica of the first with shorten range and domain to give a clearer picture at certain spots. So I would like both to appear on the same line if possible. –  Sandra Jan 9 '13 at 8:49
    
@zunbeltz - tried that as well but its not working. I even modified the width to 5cm each and still no luck. But I do receive the caption of both diagrams as (a) and (b). –  Sandra Jan 9 '13 at 8:56

2 Answers 2

up vote 6 down vote accepted
\documentclass{article}
\usepackage[demo]{graphicx}% delete [demo] later
\begin{document}

\begin{figure}[!htb]\centering
   \begin{minipage}{0.49\textwidth}
     \frame{\includegraphics[width=\linewidth]{Data1}}
     \caption{Interpolation for Data 1}\label{Fig:Data1}
   \end{minipage}
   \begin {minipage}{0.49\textwidth}
     \frame{\includegraphics[width=\linewidth]{Data2}}
     \caption{Interpolation for Data 2}\label{Fig:Data2}
   \end{minipage}
\end{figure}

\end{document}

put them in one figure environment without an empty line between. The % is important here.

share|improve this answer
    
No it didn't work out. –  Sandra Jan 9 '13 at 8:48
    
sure, 10cm +10cm is too wide for a line. Try it with width=0.49\textwidth –  Herbert Jan 9 '13 at 8:51
    
I just tried this and not sure why but this didn't workout. –  Sandra Jan 9 '13 at 9:06
    
didn't workout is not a very useful description of your problem ... –  Herbert Jan 9 '13 at 9:11
    
sorry! What I meant is my diagram is still like the usual one of top and one at the bottom even applying the width to 0.49. –  Sandra Jan 9 '13 at 9:13

I changed the width to fit it on a page, the total width you can use is dependend on the documentclass.

I would use subfigures as follows (for the image I used the tex.sx logo):

Code

\documentclass{article}
\usepackage{graphicx}
\usepackage{subcaption}

\begin{document}
\begin{figure}
\centering
\begin{subfigure}[b]{5cm}            
\frame{\includegraphics[width=5cm]{Data1}}
\caption{Interpolation for Data 1}
\label{Fig:Data1}
\end{subfigure}
%
\hspace{1cm}
%
\begin{subfigure}[b]{5cm}
\centering
\frame{\includegraphics[width=5cm]{Data2}}
\caption{Interpolation for Data 2}
\label{Fig:Data2}
\end{subfigure}
\caption{Interpolation}\label{fig:TOF}
\end{figure}
\end{document}

Output

image

share|improve this answer
    
I tried this and my graph become rather small. Do you think it is possible to make it big while ignoring the margins of the paper? And eventhough it works, the subcaption package clash with my small caption package. So when I removed the small caption package, then it works but the caption become like normal size text. –  Sandra Jan 9 '13 at 9:04
    
@Sandra I'm not familiar with the small caption package so I can't help you there, but with the page width you could use the ¸geometry package, which allows you to set specific page margins. –  xfoo Jan 9 '13 at 9:10
    
Thanks for your assistance though. I may have to use your method if other methods didn't workout even if the graph is rather small to be read considering there are three functions in one graph. –  Sandra Jan 9 '13 at 9:15
    
@Sandra Maybe you can tweak it a bit also using the height argument, as so: [width=5cm,height=5cm]. I'd say try various values and see what is closest to what you want. –  xfoo Jan 9 '13 at 9:19
    
Thanks. The function's lines and the points on the x axis is still not very clear. Not sure if it is Mathematica faults as my graphs were done using Mathematica. The previous 10cm which I used is not very clear too but still can be read when printed using laser printer. When adjust to 5cm width and height, the lines when printed, blurr out. –  Sandra Jan 9 '13 at 9:30

Not the answer you're looking for? Browse other questions tagged or ask your own question.