I am trying to use the TikZ environment to annotate a graphic with labels in multiple specific locations. Instead of repeating the node command many times and changing the node location and label, I would really like for TikZ to use coordinates and labels from custom strings that I input, along with the \foreach command.
Also, these coordinates should be given as dimensionless decimal scalars (0-1) of the total graphic width and height, so that the nodes are in respective locations even if total width/height changes. I get the scaled figure's height from specified width thanks to Will Robertson's answer to a question here.
I have a non-functioning MWE here which should take this first image and add labels like in the second. Perhaps someone could tell me what I'm doing wrong? Thanks in advance!
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usepackage{pgfmath,pgffor}
\usepackage{calc}
\def\site{{1,2,3,4,5}} %Load labels
\def\xdim{{0.038,0.149,0.488,0.668,0.872
}} %Load dimensionless x-coordinates for labels
\def\ydim{{0.57,0.908,0.713,0.632,0.688
}} %Load dimensionless y-coordinates for labels
\begin{document}
\newlength\gw
\setlength\gw{10cm} %Load graphic width
\def\mygraphic{\includegraphics[width=\gw]{label_this.jpg}}
\newlength\gh
\setlength\gh{\heightof{\mygraphic}} %Graphic height
\begin{figure}
\centering
\begin{tikzpicture}
\node at (0,0) {\includegraphics[width=\gw]{label_this.jpg}};
\foreach \i in {0,...,4}
{
\node at (\xdim[\i]\gw,\ydim[\i]\gh) {\site[\i]};
}
\end{tikzpicture}
\caption{Labelled Graphic}
\end{figure}
\end{document}



[number]for example. – Sigur Mar 05 '19 at 17:56