0

MWE which creates a pgfplot:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pdfpages}

\begin{document}

\pgfplotsset{width=15cm,height = 7cm, compat=1.9}
\pgfkeys{/pgf/number format/.cd,1000 sep={}}
\begin{tikzpicture}
\begin{axis}[
ylabel={Unemployment (millions)},
xlabel={Year},
xmin=2000, xmax=2017,
ymin=10, ymax=26,
xtick={2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016},
x tick label style={rotate=90},
ytick={10,12,14,16,18,20,22,24,26},
xmajorgrids=true,
ymajorgrids=true,
grid style=dashed,
]
\end{axis}
% \node at (6.65,3.1) {\includegraphics[width = 13.3cm, height= 5.3cm]{19mj_33_21.pdf}};
\end{tikzpicture}

\end{document}

I draw your attention to this line:

\node at (6.65,3.1) {\includegraphics[width = 13.3cm, height= 5.3cm]{19mj_33_21.pdf}};

Right now, I have hardcoded it to place it where I want. How can I do so with reference to the x and y-axis value I have defined?

Specifically, I want the bottom-left corner of the diagram to start at (2000,10) (my x-axis goes from 2000 to 2016, my y-axis goes from 10 to 26).

Thev
  • 1,568
  • 2
    Maybe this question answers your problem? https://tex.stackexchange.com/questions/9559/drawing-on-an-image-with-tikz – AndréC Dec 24 '19 at 10:04
  • 1
    \node [anchor=south west,inner sep=0] at (0,0) {\includegraphics[width = 13.3cm, height= 5.3cm]{19mj_33_21.pdf}}; –  Dec 24 '19 at 10:11
  • 2
    Dial a higher version, e.g. compat=1.16 but at least compat=1.11, or use axis cs: coordinates. –  Dec 24 '19 at 13:28
  • Or put the node inside the axis environment should even work. – vi pa Dec 24 '19 at 13:41

0 Answers0