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 have used the very nice grouping macro described here:

How can I mix an "ybar" and an "ybar stacked" with pgfplots?

I would like to be able to use it with data that I have read from a file. How can that be achieved? Instead of the data table written into the tex file, I would like to have it outside, in its own file. How can I do that so that the references to \datatable in the grouping function still work?

share|improve this question
See "4.2.8 Reading coordinates From Files" on page 51 of the pgfplots manual. – Luigi Oct 11 '12 at 9:53
I have read data from files for plots (as described in the manual), and although I have had no trouble plotting in that way, I have not been able to make the grouping function I linked to work when I read data from a file. Perhaps setting a label to the table read from a file would work, but I have not succeeded in doing that. – hjb981 Oct 11 '12 at 10:07
up vote 1 down vote accepted

Let mytable.dat be you data file, then substitute all the \pgfplotstableread environment with


and that's all.

share|improve this answer
I thought I had tried that, but I must have done something wrong earlier, because it did indeed work. – hjb981 Oct 11 '12 at 11:03

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.