TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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):

%x whiskerbottom boxbottom median boxtop whiskertop 
 0  -0.573413   -0.528268   -0.641948 -0.483655 -0.794368   

\begin{axis} [
    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)};

share|improve this question
Could you please expand your code to a full minimal working example (MWE)? Simply adding a documentclass and the tikz and pgfplots package didn't do the trick. – Benedikt Bauer Mar 29 '13 at 22:44
up vote 8 down vote accepted

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)};

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.