Hi Stefan,

you asked me to add a feature which automatically assigns labels to 
coordinates in order to allow something like

\node[pin=the 4th coord] at (coord4) {};

Well, this is already possible without any further changes:

\begin{tikzpicture}
     \begin{axis}[
         nodes near coords={},
         every node near 
coord/.style={anchor=center,name=plotidx\coordindex},
         clip marker paths=true]
         \addplot {x};
         \node[pin=Nummer 4] at (plotidx4) {};
         \node[pin=-45:Nummer 14] at (plotidx14) {};
     \end{axis}
\end{tikzpicture}

The 'nodes near coords={}' means to install the nodes near coords style 
with empty node text. The 'every node near coords/.style' causes the 
nodes to be centered at the coordinates and the 'name=...' assigns names.

This defines labeled pgf coordinates plotidx0, ..., plotidx25 . 
Unfortunately, the 'clip marker paths=true' thing is still necessary 
(might be changed eventually) because pgfplots draws marks (and nodes 
near coords) after the axis description.

I hope this helps.

Best regards

Christian

PS

Note that this feature of scatter plots does not necessarily need the 
'nodes near coords' style, compare the following code snippet:
\begin{tikzpicture}
     \begin{axis}[
         samples=5,
         %nodes near coords,
         scatter,
         scatter/@pre marker code/.code={},
         scatter/@post marker code/.code={%
             \coordinate (plotidx\coordindex) at (0pt,0pt);
         },
         clip marker paths=true]
         \addplot {x};
         \node[pin=Nummer 1] at (plotidx1) {};
     \end{axis}
\end{tikzpicture}

Here, 'scatter' enables the scatter plot mechanism and the 'pre marker 
code' and 'post marker code' things define the named coordinates (and 
replace the original scatter plot implementation which produces colored 
marks).

This feature can also (safely) be combined with nodes near coords using 
'scatter/@post marker code/.append code':

\begin{tikzpicture}
     \begin{axis}[
         samples=5,
         nodes near coords,
         scatter/@post marker code/.append code={%
             \coordinate (plotidx\coordindex) at (0pt,0pt);
         },
         clip marker paths=true]
         \addplot {x};
         \node[pin=Nummer 1] at (plotidx1) {};
     \end{axis}
\end{tikzpicture}





------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
Pgfplots-features mailing list
Pgfplots-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgfplots-features

Reply via email to