Eddy
Eddy

Reputation: 6871

gnuplot: How do I plot a function of multiple files?

I want to plot the following formula f = x+y, where x is a column from one file and y is a column from a different file.

Is this possible? How do I do it?

Upvotes: 1

Views: 280

Answers (1)

Miguel
Miguel

Reputation: 7627

Paste the files:

paste file1 file2 > file3

Then plot it:

plot "file3" u 1:($2+$4)

Or completely within gnuplot:

plot "< paste file1 file2" u 1:($2+$4)

where I assume that x was the second column in file1 and y was the second column in file2: when pasted they will be columns 2 and 4, respectively.

Upvotes: 1

Related Questions