I have a series of data plots, an example of which is depicted below, and I would like to draw a vertical line through a particular x-coordinate on each plot, so that the head of the arrow is is inline with the point having the maximum y-coordinate. After looking through the manual, I found nothing that would help me accomplish this directly (axis cs:<x>,<y> only lets me do this for each plot individually, and I will be generating thousands using one template).

Extracting the y-coordinate of the top of the plot (using \pgfextract with s.north) eluded my efforts, but even this would not solve the problem since I would still need to subtract from it the default y-limit enlargement value.

And just to show what else is possible with pgfplotstable, here's a macro that takes an x-value as the argument, finds the data point in the table with the nearest x-value, and assembles the two points for the arrow:

Again, exactly what I was looking for -- I used pgfplotstable before for relatively mundane applications but I never knew that it could sort through data. Thanks a bunch!
–
void-pointerJun 29 '11 at 1:35