8

I want to place a node at the end of a curve. Since I did not find an automatic way to realize it I tried to place it manually. But the node does not appear at the expected position. It's placed near (2,12) but not (18,17.56).

Here's a MWE (Sorry for not formatting. But I have to use my smartphone for asking since StackExchange is blocked by our proxy. And this interface doesn't offer formatting options):

\documentclass{article}
\usepackage{pgfplots,pgfplotstable}
\begin{document}

\pgfplotstableread[col sep=tab]{%
Alter   P3  
0   10.20   
0.5 14.38   
1   14.58   
1.5 14.31   
2   14.00   
2.5 13.73   
3   13.55   
3.5 13.44   
4   13.36   
4.5 13.30   
5   13.24   
5.5 13.20   
6   13.18   
6.5 13.19   
7   13.23   
7.5 13.29   
8   13.37   
8.5 13.46   
9   13.56   
9.5 13.67   
10  13.80   
10.5    13.94   
11  14.11   
11.5    14.30   
12  14.50   
12.5    14.73   
13  14.97   
13.5    15.23   
14  15.50   
14.5    15.77   
15  16.04   
15.5    16.31   
16  16.57   
16.5    16.83   
17  17.08   
17.5    17.32   
18  17.56
}\perzentile

\begin{tikzpicture}
  \begin{axis}[%
    no markers,%
    ]
    \addplot table[x=Alter, y=P3]
    {\perzentile};%
    \node at (18,17.56) {P3};%
  \end{axis}
\end{tikzpicture}
\end{document}

1 Answer 1

14

You can place nodes at the end of the plot simply by adding node {text} at the end of the \addplot command:

\addplot table[x=Alter, y=P3] {\perzentile} node {P3};

You can move the node along the plot line by using the optional [pos=<fraction>] key.

If you do want to position your node in the coordinate system manually, you should use the axis cs coordinate system:

\node at (axis cs:18,17.56) {P3};
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .