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

Given some data (from a file), I would like to use the first two columns as coordinates, and the last column as label for every point.

x    y   label
123  5.2 name

I use the table command to read the first two columns as data:

        \addplot+[only marks,x=x, y=y, ] table {Data.dat};

The data of the second column should appear above each scatter point as simple text.

A promising option seems to be the option nodes near coords, but I don't see how I can use the data from the file and combine it with that.

This question is similar to this post, where they had numerical values in the last column.

share|improve this question
up vote 9 down vote accepted

nodes near coords prints the meta value for each data point, which defaults to the y coordinate. To print something else, you have to define what the meta value is. In your case, you want to provide the meta value explicitly for each data point (and not calculate it or use a constant value, say), so you have to set point meta=explicit symbolic (the symbolic tells PGFPlots not to pass the value through the number parser). Then you can set meta=name in the \addplot table [...] options to specify that the meta value should be taken from the name column.


            nodes near coords,
            point meta=explicit symbolic
        \addplot table [meta=label] {Data.dat};
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.