# Drawing paths/nodes along a path in Tikz

I would like to draw a collection of nodes / paths. However, I'm too lazy to position them manually, I would like to specify their position along a given path. How can I do that?

Here a picture of what I did so far.

However, I want the points and labels to follow a curved path instead of a straight line.

The picture was produce by the following code, which unfortunately relies on a glitch. Namely, this only works when the \path commands are straight lines between two points. If I add more points, the guiding path is being drawn as well, which is not my intention.

\begin{tikzpicture}
\draw (0,0) circle (2);
\path (135:2.2) node[anchor=east] {$Y$};

\def\mynode#1{node [pos=#1,after node path={(\tikzlastnode) +(0,-0.3) circle (0.05)}]}
\def\y#1#2{\mynode{#1} {$y_{#2}$}}

\path (0,-1) -- (-1.5,1.5)
\foreach \num/\pos in {1/0, 3/0.3, 5/0.53}
{\y{\pos}{\num}}
\foreach \pos in {0.7,0.75,0.8,0.82}
{\mynode{\pos} {}}
[fill];
\path (0,-1) -- (1.5,1.5)
\foreach \num/\pos in {2/0.2, 4/0.45}
{\y{\pos}{\num}}
\foreach \pos in {0.6,0.7,0.75,0.8,0.82}
{\mynode{\pos} {}}
[fill];
\end{tikzpicture}

-

You might want to take a look at the decorations.markings library. It allows you to execute arbitrary code at specified distances along a path:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}[
decoration={
markings,
mark=between positions 0.25 and 0.75 step 0.125 with {\node [yshift=0.3cm] {$y_\pgfkeysvalueof{/pgf/decoration/mark info/sequence number}$};},
mark=between positions 0.125 and 0.875 step 0.125 with {\fill (0pt,0pt) circle (2pt);},
}
]
\path [postaction={decorate}] (0,0) .. controls (2,-1) .. (4,1) [in=40];
\end{tikzpicture}
\end{document}


-
Where can I find documentation for the decoration.markings library? It's not in the manual. Also, I don't want to the positions to be uniform; is there a way to supply a list of values instead of between positions A and B step D? –  Greg Graviton Mar 18 '11 at 7:53
The decorations.markings library is described on pp. 327 of the current pgf manual. It's possible to supply specific positions by using mark = at position <position> with {<command>} instead of mark=between positions`. –  Jake Mar 18 '11 at 19:09
Oops, I was reading the manual for an older version. Thanks! Works like a charm. :-) –  Greg Graviton Mar 19 '11 at 10:31