# TikZ node pin angle in 2D plot

I would like to rotate the pin corresponding to the point -3.09% to the left, but when I increase the angle past 87, it snaps to 90 and the minus sign gets in the ticks and even at 87, it doesn't look like 87 degrees (probably snapped to a lower angle). Is there a way to remove the angle snap? Here is my figure:

\begin{tikzpicture}
\begin{axis}[clip=false,xmin=0,xmax=14,ymin=-70,ymax=20,major tick style={black},minor tick style={thin,black},minor x tick num=0,minor y tick num=4]
\draw[black](axis cs:0,0) -- (axis cs:14,0);
(0,-61.5889524031168)
(1,-3.08914165008118)
(2,-6.51818367010861)
(3,2.54536181619180)
(4,-2.52797347614671)
(5,1.94530113590041)
(6,-1.68178736194508)
(7,1.45004681381708)
(8,-1.28443807064115)
(9,1.14729132172417)
(10,-1.04082348053453)
(11,0.948346997577710)
(12,-0.874976296246089)
(13,0.808047053786472)
(14,-0.754723886152266)
};
(0,-61.5889524031168)
(1,-3.08914165008118)
(2,-6.51818367010861)
(3,2.54536181619180)
(4,-2.52797347614671)
(5,1.94530113590041)
(6,-1.68178736194508)
(7,1.45004681381708)
(8,-1.28443807064115)
(9,1.14729132172417)
(10,-1.04082348053453)
(11,0.948346997577710)
(12,-0.874976296246089)
(13,0.808047053786472)
(14,-0.754723886152266)
}
node[pos=0,pin=10:${-}61.59$\%] {}
node[pos=0.1,pin=87:${-}3.09$\%] {}
node[pos=0.15,pin=290:${-}6.52$\%] {}
node[pos=0.2,pin=75:$2.55$\%] {}
node[pos=1,pin=210:${-}0.75$\%] {};
\end{axis}
\end{tikzpicture}

-
A similar issue has been discussed extensively in how-can-i-force-tikz-pin-angle – percusse Mar 27 '12 at 13:04
I had checked this post before posting and didn't quite find my answer there. Because I don't want inner sep=0pt (which removes the separation from the node, right?) I would like to keep the small space between the node and the pin, but remove the angle snap. Is this possible? – user12876 Mar 27 '12 at 13:12

Here is a customization of the answer that I took from How can I force TikZ pin angle? .

Replacing the problematic code with the following

node[pos=0.1,pin={[inner sep=0pt,label={[inner ep=0pt,xshift=-5mm]80:${-}3.09$\%}]80:{}}] {}


gives

A bit of explanation of this code:

Labels are themselves are nodes so usual settings apply directly. However, skipping the cause of the problem and referring to the linked question, we need to put an empty label (which is a node) and then label that one again with Jake's neat idea. But keep in mind that you have to change the angle in both occasions (80 right now). Then because the pin points to the empty node we have to further shift its own label to the left by xshift=-5mm, you can adjust for your needs for that extra space you mentioned. The rest is hopefully relatively easy to understand.

-
The angle seems to work well on the pin with this method, but the label is still snapped to either 90 or 45 (so the label angle isn't really important). However, you are correct, as it can be manually shifted to take the correct position. – user12876 Mar 27 '12 at 14:06
@user12876 Indeed, it still has problems. However, as Andrew Stacey mentioned in his answer. Labels and pins are not the most robust tools that are offered when it comes to modify them. I would suggest drawing the pin manually with shorten options etc. whenever it needs a slight hack – percusse Mar 27 '12 at 15:35

To position the label text automatically without snapping at 45 degree intervals, you'll have to use a "normal" node instead of the label one. You can insert such nodes using append after command={ node [at=(\tikzlastnode), anchor=<angle>+180, inner sep=0pt] {<label text>} }. The macro \tikzlastnode will hold a reference to the node from which the append after command key is called.

Here's a new style, precise pin=<angle>:<label text> that will place a pin using this approach:

precise pin/.style args={#1:#2}{
pin={[
inner sep=0pt,
label={[
append after command={
node [
inner sep=0pt,
at=(\tikzlastnode.#1),
anchor=#1+180
] {#2}
}
]center:{}}
]#1:{}}
}


Using this in your plot will yield

\documentclass{article}
\usepackage{pgfplots}

0,-61.5889524031168
1,-3.08914165008118
2,-6.51818367010861
3,2.54536181619180
4,-2.52797347614671
5,1.94530113590041
6,-1.68178736194508
7,1.45004681381708
8,-1.28443807064115
9,1.14729132172417
10,-1.0408234805345
11,0.94834699757771
12,-0.87497629624609
13,0.808047053786472
14,-0.754723886152266
}\datatable

\begin{document}
\begin{tikzpicture}[
precise pin/.style args={#1:#2}{
pin={[
inner sep=0pt,
label={[
append after command={
node [
inner sep=0pt,
at=(\tikzlastnode.#1),
anchor=#1+180
] {#2}
}
]center:{}}
]#1:{}}
}
]

\begin{axis}[clip=false,xmin=0,xmax=14,ymin=-70,ymax=20,major tick style={black},minor tick style={thin,black},minor x tick num=0,minor y tick num=4]
\draw[black](axis cs:0,0) -- (axis cs:14,0);
node[pos=0,precise pin=20:${-}61.59$\%] {}
node[pos=0.1,precise pin=85:${-}3.09$\%] {}
node[pos=0.15,precise pin=290:${-}6.52$\%] {}
node[pos=0.2,precise pin=35:$2.55$\%] {}
node[pos=1,precise pin=210:${-}0.75$\%] {}
;
\end{axis}
\end{tikzpicture}

\end{document}

-