2

I have a image in a beamer and I want to overlay a table on that image. How can I achieve that ?

I have a figure that I created in powerpoint which is as follows:

enter image description here

In the above figure, the statistical parameters such as RMSE and NSE are added later. Is it possible to add similar thing in latex beamer ? I want to show the text first on the upper panel and then on the bottom panel.

Thanks.

Jdbaba
  • 2,643

2 Answers2

3
\begin{picture}(0,0)
\put(10,20){\includegraphics{...}}
\put(40,30){\begin{tabular}{...}...\end{tabular}}
\end{picture}

allows you to overlay anything on any part of the page, modify the coordinates to your needs.

If you need to add beamer \only<...> they can be added so the table is not initially over the image.

David Carlisle
  • 757,742
  • David, Can i ask you one thing ? How does the coordinates work ? I belive the first is x cordinate and second is y coordinate. Are the coordinates referenced from the top left ? My image doesn't fully load. – Jdbaba Jun 18 '13 at 17:49
2

Here's a possibility using TikZ (an advantage is the easy integration with beamer overlay specification):

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

\begin{frame}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) 
  at (0,0) 
  {\includegraphics[width=\textwidth,height=6cm]{example-image-a}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\node<2-> at  (0.78,0.75) {%
  \begin{tabular}{@{}ll@{}}
  RMSE & 0.059m \\
  NSE & 0.798
  \end{tabular}%
};
\node<3-> at  (0.78,0.20) {%
  \begin{tabular}{@{}ll@{}}
  RMSE & 0.042m \\
  NSE & 0.298
  \end{tabular}%
};
\end{scope}
\end{tikzpicture}
\end{frame}

\end{document}

enter image description here

The other advantage of this approach is that the coordinates for placement are relative to the image: (0,0) represents the bottom left corner, and (1,1) is the top right corner. A grid can also easily be placed for additional visual help:

\documentclass{beamer}
\usepackage{tikz}

\newcommand\MyGrid{%
\draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);
\foreach \x in {0,1,...,9} { \node [anchor=north] at (\x/10,0) {0.\x}; }
\foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
}

\begin{document}

\begin{frame}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) 
  at (0,0) 
  {\includegraphics[width=\textwidth,height=6cm]{example-image-a}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\MyGrid
\end{scope}
\end{tikzpicture}
\end{frame}

\end{document}

enter image description here

This is an adaptation of the method described in Drawing on an image with TikZ.

Moriambar
  • 11,466
Gonzalo Medina
  • 505,128
  • @Gonazalo Medina: Can I add another image to overlay like the table ? I tried the following: \node<4-> at (0.1,0.9){% {\includegraphics[width=1\textwidth]{figurer/station-t1-vp}} }; before {end(scope} but it shifts the original image sideways. Any suggestions ? – Jdbaba Jun 18 '13 at 19:13
  • @Jdbaba add the new image at (0.5,0.5) as in \node<4-> at (0.5,0.5) {\includegraphics[width=\textwidth,height=2cm]{image}};. – Gonzalo Medina Jun 18 '13 at 19:17
  • @Jdbaba otherwise, reduce the width for the second image. Using \textwidth for the new image at a position with x-coordinate different from 0.5 will shift the initial image. – Gonzalo Medina Jun 18 '13 at 19:21