0

I have a presentation and I want to add two figures in one frame step by step. For example:

When I want to explain X, figure 1 should be shown: enter image description here

And when I want to explain Y, figure 2 should be shown:

enter image description here

Could you help me with that? Thank you so much.

Meskaj
  • 185
  • 7
  • You want these two figures as subfigures of a single figure? – SolidMark Jun 21 '21 at 04:15
  • A single figure on one frame. – Meskaj Jun 21 '21 at 04:17
  • Then you can try using subfigure environment for each figure inside the figure environment. You also include caption, subcaption package for the purpose. – SolidMark Jun 21 '21 at 04:19
  • I don't want to show two figures. I want to show each figure in one time. At the first step figure 1 should be shown, and then figure 2 should be shown (figure 1 does not show) – Meskaj Jun 21 '21 at 04:21
  • Then you can use another frame? One figure for each frame. – SolidMark Jun 21 '21 at 04:23
  • No. like the PowerPoint that we can show the figure when we want at the same place. I want something like that. – Meskaj Jun 21 '21 at 04:24
  • Then what you meant might be overlays. You can try something like \includegraphics<#> where # is the index of the figure you want to display in particular order. say \includegraphics<1>{figurex} then \includegraphics<2>{figurey}. – SolidMark Jun 21 '21 at 04:39

1 Answers1

2

You can use overprint or overlayarea.

The syntax for both will be (taken from here)

\begin{overlayarea}{⟨area width⟩}{⟨area height⟩}
  ⟨environment contents⟩
\end{overlayarea}

\begin{overprint}[⟨area width⟩] ⟨environment contents⟩ \end{overprint}

So you can do the following.

\documentclass{beamer}
\usetheme{Boadilla}

\usepackage{graphicx}

\begin{document} \begin{frame}

    \begin{figure}[htbp]
        \begin{overprint}[6cm]
            \includegraphics&lt;1&gt;[scale=0.5]{Img-1.png}
            \includegraphics&lt;2&gt;[scale=0.5]{Img-2.png}
        \end{overprint}
    \end{figure}

\end{frame} 

\end{document}

enter image description here

  • Thank you so much. I have one small question. Is that possible to set that when figure 2 shows? for example, after we click on the pdf file, it shows, or 1 second after the figure one. – Meskaj Jun 21 '21 at 05:34
  • @Meskaj the above will be done after the mouse click. So in the presentation mode, if you click on the pdf or down arrow of your keyboard, then only the slide will change and you will get the next picure. – Sachchidanand Prasad Jun 21 '21 at 05:44
  • That's great. Thank you so much. – Meskaj Jun 21 '21 at 05:46
  • I don't know why this is not work in my environment. Even when I copy your code in the new .tex file, it does not work. It places two figures on two pages. – Meskaj Jun 21 '21 at 06:20
  • Yes, it will place two figures, but that is with pauses. That is what beamer does. Whenever you have pause it will be on the new page. So for seeing the behavior you need to go to the presentation mode and then you can see. – Sachchidanand Prasad Jun 21 '21 at 06:41
  • Wow. That's great. I did not know this. Thanks – Meskaj Jun 21 '21 at 06:43