Take the 2-minute tour ×
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.

I have several data files that I would like to combine into one table using pgfplots table. Specifically, I would like to use one file to set the first three columns and then have each data file fill in another column after that (the first two columns are experimental parameters, consistent in every file). The files are tab delineated.

Can I set pgfplots up to do this, and if so, how? I've dug through the manual and tried using pgfplotscreatecolumn and createonuse but neither one seems to be suited to the task.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

You can do this using the copy column from table option of the \pgfplotstablecreatecol command (see p. 39 of the pgfplotstable manual).

Given the two files

<dataA.dat>
4.1 .1 1.1       
3.2 .2 1.2
5.3 .3 1.3

<dataB.dat>
-1 0
2  1
4  -1

You can add the columns from to the first table like so:

\documentclass{article}

\usepackage{pgfplotstable}

\begin{document}
\pgfplotstableread{dataA.dat}\dataA
\pgfplotstableread{dataB.dat}\dataB

\pgfplotstablecreatecol[copy column from table={\dataB}{[index] 0}] {par1} {\dataA}
\pgfplotstablecreatecol[copy column from table={\dataB}{[index] 1}] {par2} {\dataA}

\pgfplotstabletypeset{\dataA}
\end{document}
share|improve this answer
add comment

Your Answer

 
discard

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.