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

Is it possible to draw a graph with pgfplots using data from different files ?

Let say I have two data files : data.dat and error.dat and would like to plot column 1 versus column 0 from data.dat and add error bars from error.dat.

If the data all came from the same file all.dat, I would use :


\addplot  table[x index=0,y index=1, y error index=3]{\mytable};
share|improve this question
up vote 15 down vote accepted

It is possible. You can make a column from a different table available on the fly using

    create on use/<new column name>/.style={
        create col/copy column from table={<file or table>}{<column name>}

So, to get something like

you could do something like

X   Y
1   3
2   7
3   4
4   5
5   5
6   9




    create on use/errors/.style={
        create col/copy column from table={error.dat}{Errors}

\addplot +[
    error bars/.cd,
        y explicit,
        y dir=both
    ] table [y error=errors] {\datatable};

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.