[Tex/LaTex] Tikz,PGFplots: drawing in node’s cs placed on plot

nodespgfplotstikz-pgf

I'm trying to place some arrows which should be placed alongside the graphs. I place nodes on the graph using

node[pos=0.2,above] (point1) {} 

Then I want to draw in that coordinate system

\draw [->] (node cs:name=point1,anchor=north) -- (0,1);

but this doesn't work at all.

Here's the complete code:

\begin{tikzpicture}
\tikzexternaldisable
\begin{axis}[xlabel=$\lambda$,ylabel=$M_R$
domain=0:50,
width=12cm,
height=8cm,
ytick=\empty
]
\addplot[smooth,black] table[x=lam,y expr=\thisrow{ct}] {bilder/mr/ct.out} node[pos=0.6]{};
\addplot[smooth,black] table[x=lam,y expr=\thisrow{ct}*2] {bilder/mr/ct.out}
 node[pos=0.2,circle,fill=black,scale=0.3] (point1) {}  
 node[pos=0.6,circle,fill=black,scale=0.3] (point1) {};
\addplot[smooth,black] table[x=lam,y expr=\thisrow{ct}*4] {bilder/mr/ct.out} node[pos=1, above] {$W$} node[pos=1,xshift=12pt,yshift=-10pt] (v1) {} ;
\draw (node cs:name=a1,anchor=north) [->]  (0,0) -- (0,1);

\end{axis}
\end{tikzpicture}

The ct.out looks like this:

    lam ct  cp
0.4 0.012360489 0.004944196
0.8 0.020495909 0.016396727
1   0.027456016 0.027456016
1.2 0.039743915 0.047692698
1.5 0.062400877 0.093601316
1.7 0.08363738  0.142183546
1.9 0.10823897  0.205654043
2   0.11533637  0.23067274
2.1 0.11622777  0.244078317
2.3 0.11317585  0.260304455
2.5 0.10662368  0.2665592
3   0.087667927 0.263003781
3.5 0.069310704 0.242587464
4   0.0525382   0.2101528
5   0.0262106   0.131053
6   0.003988099 0.023928596

Arrows should look like this
Arrows should look like this

Best Answer

This is not a perfect solution but you can start with something like:

\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
%\tikzexternaldisable
\begin{axis}[xlabel=$\lambda$,ylabel=$M_R$
domain=0:50,
width=12cm,
height=8cm,
ytick=\empty
]
\addplot[smooth,black] table[x=lam,y expr=\thisrow{ct}] {ct.out} node[pos=0.6]{};
\addplot[smooth,black] table[x=lam,y expr=\thisrow{ct}*2] {ct.out}
 coordinate[pos=0.1] (point00) 
 node[pos=0.2,circle,fill=black,scale=0.3] (point1) {}
 coordinate[pos=0.2] (point01) 
 coordinate[pos=0.25] (point02)  
 node[pos=0.6,circle,fill=black,scale=0.3,outer sep=1mm] (point2) {};
\addplot[smooth,black] table[x=lam,y expr=\thisrow{ct}*4] {ct.out} node[pos=1, above] {$W$} node[pos=1,xshift=12pt,yshift=-10pt] (v1) {} ;
\draw[<-,blue,thick,shorten >=2mm] ([yshift=2mm]point00) -- ([yshift=2mm]point01);
\draw[->,blue,thick] ([yshift=2mm]point01) -- ([yshift=2mm]point02);
\draw[->,red,thick] (point2.north east) --++(-25:1cm); 
\draw[->,red,thick] (point2.north) --++(150:2cm); 
\end{axis}
\end{tikzpicture}
\end{document}

You can draw arrows between two points (blue ones) or using relative coordinates (red ones). Syntax is ++(increment x, increment y) or ++(angle:length). Setting an outer sep for point1 and point2 (as Altermundus suggested) avoid need for yshift.

The result is

enter image description here