# pgfplots, toks, position of pin edge

I want to use pins to comment specific points in a diagramm. When I use a edge like -> it works fine. But if I use *- for example then the center of the dot is not at the position it should be. Maybe it's a problem with the anchor. Here is an example:

\documentclass[]{article}

\usepackage{tikz}
\usepackage{pgfplots}
\usepgflibrary{arrows}

\begin{document}

\begin{tikzpicture}
\begin{axis}%
[
axis y line = left,
axis x line = middle,
grid
]
\node%
[
coordinate,
pin={[pin edge={*-}]50:{text}}
]
at (axis cs:2,1) {};
%
\node%
[
coordinate,
pin={[pin edge={red}]-50:{text}}
]
at (axis cs:2,1) {};
\end{axis}
\end{tikzpicture}

\end{document}

The close up shows the problem:

Any ideas?

• Center of the dot is not relevant. The arrow head is the whole circle and it's computed to touch the target point not land on it. If you want circle on the target put a circle node and apply pin on that particular node. – percusse May 20 '13 at 17:21

This happens because the circle is treated like an arrow head, so it is flush with the end of the line. You can use the shorten < syntax (see Modifying * and o style tikz arrows so that they are centered at the end of line) to manually adjust the position, or you can define a new arrow tip (based on the standard one) to position the circle precisely on the specified coordinate:

\documentclass[]{standalone}

\usepackage{tikz}
\usepackage{pgfplots}
\usepgflibrary{arrows}

\makeatletter
\pgfarrowsdeclare{center*}{center*}
{
\pgfutil@tempdima=0.4pt%
\pgfarrowsleftextend{0pt}
\pgfarrowsrightextend{0pt}
}
{
\pgfutil@tempdima=0.4pt%
\pgfsetdash{}{+0pt}
\pgfpathcircle{\pgfqpoint{0pt}{0pt}}{+4.5\pgfutil@tempdima}
\pgfusepathqfillstroke
}

\makeatother

\begin{document}

\begin{tikzpicture}
\begin{axis}%
[
axis y line = left,
axis x line = middle,
grid
]
\node%
[
coordinate,
pin={[pin edge={center*-}]50:{text}}
]
at (axis cs:2,1) {};
%
\node%
[
coordinate,
pin={[pin edge={red}]-50:{text}}
]
at (axis cs:2,1) {};
\end{axis}

\end{tikzpicture}

\end{document}
• Thanks for the answer. I thought there might be an easier way. Damn. – Dr. Manuel Kuehner May 20 '13 at 17:28
• @ManuelKuehner: Well, the shorten < option is pretty easy. – Jake May 20 '13 at 17:30