TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

I am trying to make an xbar chart using pgfplots, and I'd like to add the bar's value to the bar.

Simply using "nodes near coords" positions the value for a ybar chart, which isn't correct here. What's the best way to position these nodes? enter image description here

My code:

Label     value       num
992       70          1
993       120         2
994       30          3
995       330         4
999       50          5
988       50          6
989       50          7
983       50          8

    xlabel=My value,
    ylabel=Label here,
    yticklabels from table={my.dat}{Label},
    nodes near coords,
    \addplot table [x=value, y=num]

share|improve this question
up vote 6 down vote accepted

You can tell pgfplots to label the coordinates correctly by setting nodes near coords align=horizontal.

share|improve this answer
Interesting - that should have worked automatically for xbar. Probably a bug; I'll take a note to look into it. – Christian Feuersänger Oct 16 '11 at 10:58

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.