TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I ensure that the four plots (which are all the same size pdfs) appear with the same spacing: see they are offset here:

Offset Image % Actual versus predicted plots

\begin{figure}[H]
\begin{minipage}[b]{0.45\linewidth}
\centering
\includegraphics[width=\textwidth]{figs/immediate_formula_s_avp.pdf}
\hspace{0.1cm}
\end{minipage}
\begin{minipage}[b]{0.45\linewidth}
\centering
\includegraphics[width=\textwidth]{figs/immediate_formula_s_avp.pdf}
\end{minipage}
\begin{minipage}[b]{0.45\linewidth}
\centering
\includegraphics[width=\textwidth]{figs/immediate_formula_s_avp.pdf}
\hspace{0.1cm}
\end{minipage}
\begin{minipage}[b]{0.45\linewidth}
\centering
\includegraphics[width=\textwidth]{figs/immediate_formula_s_avp.pdf}
\end{minipage}
\caption{Actual Versus Predicted Plots}\label{multiavp}
\end{figure}
share|improve this question
    
Try with removing the empty lines in between. They are starting a new line. For the captions see the subcaption package. That would also fix the minipage problem completely. – percusse Dec 11 '12 at 16:24
    
Awesome @percusse, you've helped me out again. Is there a good way to only reference the entire figure with a single caption/label? – mike Dec 11 '12 at 16:27
    
Yes subcaption package has a \phantomcaption command which will hide the individual one to which it is provided but leaves the main caption untouched. – percusse Dec 11 '12 at 16:28
    
Great, all set on the captions -- any chance you could shed some light on the offset nature of the plots? – mike Dec 11 '12 at 16:35
    
@mike Try a run with all four images being the same .pdf or with [demo]{graphicx}, problem is your second image is not the same size. – Yiannis Lazarides Dec 11 '12 at 16:56
up vote 3 down vote accepted

I've taken your code and made a few modifications, such as removing all \centering statements: They're not needed if you (i) use \hspace{\fill} directives between the first and second and between the third and fourth minipages and (ii) set the width of the graphs inside each minipage to \linewidth. Incidentally, I would use the \textwidth parameter to specify the width of minipage environments, and \linewidth (or a fraction thereof) for measurements inside a minipage environment.

enter image description here

\documentclass{article}
\usepackage[demo]{graphicx} % leave off demo option in real program
\begin{document}

\begin{figure}    
\begin{minipage}[t]{0.45\textwidth}
\includegraphics[width=\linewidth]{figs/immediate_formula_s_avp.pdf}
\caption{Actual Versus Predicted: Immediate}
\label{fig:immediate}
\end{minipage}
\hspace{\fill}
\begin{minipage}[t]{0.45\textwidth}
\includegraphics[width=\linewidth]{figs/proximal_formula_s_avp.pdf}
\caption{Actual Versus Predicted: Proximal}
\label{fig:proximal}
\end{minipage}

\vspace*{0.5cm} % (or whatever vertical separation you prefer)
\begin{minipage}[t]{0.45\textwidth}
\includegraphics[width=\linewidth]{figs/distal_formula_s_avp.pdf}
\caption{Actual Versus Predicted: Distal}
\label{fig:distal}
\end{minipage}
\hspace{\fill}
\begin{minipage}[t]{0.45\textwidth}
\includegraphics[width=\linewidth]{figs/combined_formula_s_avp.pdf}
\caption{Actual Versus Predicted: Combined}
\label{fig:combined}
\end{minipage}

\end{figure}
\end{document}
share|improve this answer
    
Thanks so much @Mico, saved my day! – mike Dec 11 '12 at 17:58
    
Hi Mico, I really like your solution, its extremely elegant but I was just wondering if I can modify this for a two column document format ? – CutestPenguin Oct 30 '15 at 20:56
1  
@CutestPenguin - Have you tried replacing the figure environment with a figure* environment? – Mico Oct 30 '15 at 21:33
    
@Mico : That actually works! Thanks a lot. – CutestPenguin Nov 2 '15 at 2:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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