# How to single label a point in pgfplots with text?

This seems like it should be straightforward but I'm new to using pgfplots. I have been using this awesome box plot code and would like to be able to add a single point

How can I make:

\addplot[color = black, mark = *, nodes near coords,every node near coord/.style={anchor=180}]coordinates {( 0, -1)};


Label with a text label (say mylabel) rather than the value (-1) which is displayed?

The total code is (combined with box plotting code):

\begin{filecontents}{testdata.dat}
%x whiskerbottom boxbottom median boxtop whiskertop
0  -0.573413   -0.528268   -0.641948 -0.483655 -0.794368
\end{filecontents}

\begin{tikzpicture}
\begin{axis} [
xtick={0},
xticklabels=test,
box plot width=10mm]

\boxplot [black]{testdata.dat}
%I've modified things to get to this point but cannot seem to figure out how to add a text label to it
\addplot[color = black, mark = *, nodes near coords,every node near coord/.style={anchor=180}]coordinates {( 0, -1)};

\end{axis}
\end{tikzpicture}


You can set the contents of the nodes by using the optional argument to node near coords=<content>. By default, it's set to \pgfmathprintnumber{\pgfplotspointmeta}, but you can use any text or code. To use the static text mylabel, you'd say nodes near coords=mylabel:

\addplot [black, mark = *, nodes near coords=mylabel,every node near coord/.style={anchor=180}] coordinates {( 0, -1)};


I wanted to add a single point based on a predefined function but couldn't find an appropriate answer among this question and related questions.

Therefore, for future reference, if you have your own function defined as e.g.:

\begin[tikzpicture][declare function={y(\x) = \x^2;}] ...


And you want to add a single point based on this function, you should use:

\addplot [only marks,samples at={5}] {y(x)};


That's the best way to add a single point to an existing function, regardless of your axis setup or of other functions that have been added to the plot.

Hope this might help someone out in the future.