8

I have a figure which consists of 4 plots, Full figure here, and I want to have them appearing one by-one in the presentation (from left to right, top to bottom). I managed to do this by including each plot separately using a combination of \subfloat and \pause:

\begin{frame} \frametitle{Cufflinks analysis - SRSF1}
  \begin{figure}[t]
    \centering
     \captionsetup[subfloat]{labelformat=empty}
      \subfloat[]{\label{} \includegraphics[scale = 0.20]{Image1.pdf}} 
      \pause \subfloat[]{\label{} \includegraphics[scale = 0.20]{Image2.pdf}}\\
      \pause \subfloat[]{\label{} \includegraphics[scale = 0.20]{Image3.pdf}}
      \pause \subfloat[]{\label{} \includegraphics[scale = 0.20]{Image4.pdf}}
  \end{figure}
\end{frame}

[edit] Result: example

The issue with this solution is that the vertical spacing between the rows of images is rather large. I would like to reduced it in order to increase the size of each image - better use of space really.

If someone has a simple alternative where all 4 plots are part of a single image and each part is uncovered when needed it would be great.

Be gentle, this is my 1st beamer presentation.

David Carlisle
  • 757,742

3 Answers3

10

It's not much different than what you have already.

\documentclass{beamer}
\usepackage{mwe} % For dummy images
\usepackage{lmodern} % To suppress some warnings

\begin{document}
\begin{frame}
\centering
\begin{tabular}{c@{}c}
 \includegraphics[width=0.4\textwidth,trim=0 120 160 0,clip]{example-image-a}\pause% 
&\includegraphics[width=0.4\textwidth,trim=160 120 0 0,clip]{example-image-a}\\[-1.5mm]\pause%
 \includegraphics[width=0.4\textwidth,trim=0 0 160 120,clip]{example-image-a}\pause%
&\includegraphics[width=0.4\textwidth,trim=160 0 0 120,clip]{example-image-a}
\end{tabular}

\end{frame}
\end{document}

enter image description here

The trimming might not be good as I did it by eyeballing.

EDIT For the custom image, the following trim values seem to work.

\documentclass{beamer}
\usepackage{graphicx}
\usepackage{lmodern} % To suppress some warnings

\begin{document}
\begin{frame}
\centering
\begin{tabular}{c@{}c}
 \includegraphics[width=0.3\textwidth,trim=0 270 260 0,clip]{SRSF1_details_1fig}\pause% 
&\includegraphics[width=0.3\textwidth,trim=260 270 0 0,clip]{SRSF1_details_1fig}\\[-1.5mm]\pause%
 \includegraphics[width=0.3\textwidth,trim=0 0 260 265,clip]{SRSF1_details_1fig}\pause%
&\includegraphics[width=0.3\textwidth,trim=260 0 0 265,clip]{SRSF1_details_1fig}
\end{tabular}

\end{frame}
\end{document}

enter image description here

percusse
  • 157,807
  • How did you find -1.5mm? – Paul Gaborit Sep 22 '12 at 16:08
  • @PaulGaborit Just a quick guess. – percusse Sep 22 '12 at 16:46
  • Thanks for the help @percusse, but it not really working for me. When I tested it I got superimposition of images in. Then I tried to check the trimming by trial and error using just one image: begin{frame} \frametitle{Cufflinks analysis - SRSF1} \centering \begin{tabular}{c@{}c} \includegraphics[scale = 0.48,trim=0 0 250 0,clip]{Image1.pdf} \end{tabular} \end{frame}. IN this case besides being clipped the image is also (bizarrely) relocated to the vertical centre. – fridaymeetssunday Sep 23 '12 at 15:10
  • @krespim trim entries goes like left bottom right top. Right now you are only trimming the right side with 0 0 250 0. Can you upload you image to the question so that I can modify my answer? – percusse Sep 23 '12 at 15:16
  • @peruse: done. I've added the link to the figure (pdf) – fridaymeetssunday Sep 23 '12 at 15:47
  • @krespim Is it better now? The whitespace is because you don't trim enough. If you put boxes around your subplots trimming is always easier. – percusse Sep 23 '12 at 17:20
  • It working flawlessly @percusse! I could even increase the width to 0.4. In the meantime I've used your code with a few changes to have the 4 separate plots with less space between them: \begin{frame} \centering \begin{tabular}{c@{}c} \includegraphics[width=0.4\textwidth]{Image1}\pause% &\includegraphics[width=0.4\textwidth]{Image2}\\[-1.5mm]\pause% \includegraphics[width=0.4\textwidth]{Image3}\pause% &\includegraphics[width=0.4\textwidth]{Image4} \end{tabular} \end{frame}. This might be useful in the future but your solution is better. Thanks a lot. – fridaymeetssunday Sep 23 '12 at 17:29
  • Consider adding \usepackage{adjustbox} to the preamble, replacing includegraphics with adjincludegraphics, 120 with {0.5\height}, 160 with {0.5\width}, and voila, no more guessing about trimming 50% (credit). See new answer for copy-able code. – Sterling Mar 04 '21 at 09:21
4

You could use TikZ and put the pictures in nodes. With no inner sep or outer sep they align perfectly. If you need spacing, you can use <position>=<distance>, like above right=3mm

Code

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\begin{frame} \frametitle{Cufflinks analysis - SRSF1}
  \begin{figure}[t]
    \begin{center}
        \begin{tikzpicture}
                \node[above right,inner sep=0,outer sep=0] {\includegraphics[scale=0.7]{test}};\pause
                \node[above left,inner sep=0,outer sep=0] {\includegraphics[scale=0.65]{test}};\pause
                \node[below right,inner sep=0,outer sep=0] {\includegraphics[scale=0.75]{test}};\pause
                \node[below left=0.5cm,inner sep=0,outer sep=0] {\includegraphics[scale=0.6]{test}};
            \end{tikzpicture}
    \end{center}
  \end{figure}
\end{frame}

\end{document}

Result

enter image description here

Tom Bombadil
  • 40,123
2

Building off of what @percusse described and this post, you can get automatic 50% cropping by first loading adjustbox via \usepackage{adjustbox} and then:

\centering
  \begin{tabular}{c@{}c}
 \adjincludegraphics[width=0.4\textwidth,trim=0 {0.5\height} {0.5\width} 0,clip]{example-image-a}\pause% 
&\adjincludegraphics[width=0.4\textwidth,trim={0.5\width} {0.5\height} 0 0,clip]{example-image-a}\\[-1.5mm]\pause%
 \adjincludegraphics[width=0.4\textwidth,trim=0 0 {0.5\width} {0.5\height},clip]{example-image-a}\pause%
&\adjincludegraphics[width=0.4\textwidth,trim={0.5\width} 0 0 {0.5\height},clip]{example-image-a}
\end{tabular}

The behavior seems to be preserved (here's the 3rd frame): enter image description here

Sterling
  • 171