# anchor element in a beamer presentation

This code

\documentclass{beamer}
\usepackage{graphicx}
\begin{document}
\begin{frame}
The initial image\\
\includegraphics[width=0.6\paperwidth]{example-image-a}
\end{frame}
\begin{frame}
The same image\\
after some changes have been made\\
\includegraphics[width=0.6\paperwidth]{example-image-b}
\end{frame}
\end{document}


produces the output

I would like the image to sit in one place as the text changes on each slide. How to achieve it?

• Look into overlayarea, chapter "9.5 Dynamically Changing Text or Images" of the beamer user guide. – user36296 Jan 28 '18 at 11:48

In the special case when both your images have the same dimensions, you can simply exchange them:

\documentclass{beamer}

\begin{document}

\begin{frame}
\alt<1>{The initial image}{The same image}

\visible<2->{after some changes have been made}

\includegraphics<1>[width=0.6\paperwidth]{example-image-a}%
\includegraphics<2->[width=0.6\paperwidth]{example-image-b}
\end{frame}
\end{document}


Off-topic:

• you don't need to load graphicx with beamer, beamer already provides this functionality
• better use an empty line to indicate a new paragraph