I use following code, as I once showed here, to put descriptive labels on a picture:
\documentclass[margin=1cm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=5cm]{airplane.png}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
% \draw[help lines, very thin, step=0.02] (0,0) grid (1,1);
% \draw[help lines,thin,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}; }
\draw[<-] (0.5,0.6) -- (0.7,1.1) node[above] {label above};
\draw[<-] (0.3,0.5) -- (0.4,-0.1) node[below] {label below};
\draw[<-] (0.7,0.6) -- (1.1,0.7) node[right] {label right};
\draw[<-] (0.1,0.7) -- (-0.1,0.8) node[left] {label left};
\end{scope}
\end{tikzpicture}
\end{document}
Result:
(I got the airplane picture from here)
As one can see, I want the labels positioned such that the label text is above the arrow if the arrow ends above the image, and I want the label text left of the arrow if the arrow ends left of the image, and so on. It is somewhat redundant to specify the end coorindate of x=-0.1, which is left of the image, and also the label position as node[left].
So I wonder whether there is a possibility to automate this such that only the starting coordinate needs to be specified and one of the end coordinates, as well as the orientation (left, right, above, below), e.g. like the following
\draw[<-] (0.1,0.7) node[left, y=0.8] {label left};
which, of course, does not work as I wrote it here, this is just an example. This should place the label left of the arrow, which would have its endpoint at x=-0.1 and y=0.8.
N.B.: the section I commented out in my MWE is just to display some coordinate grid to find the starting positions of the arrows.
Further, there is another problem with the labels. Consider the following picture
where one label has the letter p in it (which goes a little bit further down than the baseline), and the other node doesn't. The result is that the labels are not on the same height, which is ugly. It can be fixed by using a strut{}
in the label text, e.g.
\draw[<-] (0.4,0.6) -- (0.7,1.1) node[above] {\strut{} aaa};
\draw[<-] (0.3,0.6) -- (0.4,1.1) node[above] {\strut{} paaaaa};
which gives following result:
How can the strut be automatically added to the label text? Or should the baseline of the TikZ labels be shifted?
\tikzset{every node/.append style={text depth=0.25ex}}
.