1

Using the following code, as a part of a more complicated drawing, how to move the included graphic vertically in relation to the node, keeping it on the background layer.

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{backgrounds}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{minipage}[c]{.9\textwidth}
\begin{center}
\vskip 1.4cm
\begin{tikzpicture}[scale=.7, transform shape]
\begin{scope}[xshift=0cm, yshift=0cm]
\draw [thick] (0,0) -- (9,0) -- (9,7.14);
\draw [thick] (0,0) -- (0,7.14)  node[xshift=.6cm, yshift=.48cm]{percent} -- (9,7.14);
\end{scope}
\node [black] at (1.6,5) (euro){\scriptsize Euro area} ([shift={(-90.:2.48cm)}]euro.center) node {\scriptsize United States};
\begin{scope}[on background layer]
\hspace {.16cm}
\includegraphics[height=3.2cm,keepaspectratio]{./13-CrossSectionTimeSeriesData.png}
\end{scope}
\end{tikzpicture}
\end{center}
\end{minipage}
\end{frame}
\end{document}

This code producedenter image description here

I need it to beenter image description here

Hany
  • 4,709

1 Answers1

4

You should not just use \includegraphics "naked" in the tikzpicture but put it in a node. This also solves the problem of positioning the graphics.

\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{backgrounds}
\begin{document}
\begin{frame}[t]
\frametitle{}
\begin{minipage}[c]{.9\textwidth}
\centering
\begin{tikzpicture}[scale=.7, transform shape]
\path (0,10);
\begin{scope}[xshift=0cm, yshift=0cm]
\draw [thick] (0,0) -- (9,0) -- (9,7.14);
\draw [thick] (0,0) -- (0,7.14)  node[xshift=.6cm, yshift=.48cm]{percent} -- (9,7.14);
\end{scope}
\node [black] at (1.6,5) (euro){\scriptsize Euro area} 
([shift={(-90.:2.48cm)}]euro.center) node {\scriptsize United States};
\begin{scope}[on background layer]
\node[anchor=west] at ([shift={(-0.7cm,-1cm)}]euro.west) 
{\includegraphics[height=3.2cm,keepaspectratio]{./13-CrossSectionTimeSeriesData.png}};
\end{scope}
\end{tikzpicture}
\end{minipage}
\end{frame}
\end{document}

enter image description here