1

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?

Eddy
  • 6,661
  • 21
  • 58
  • 71
  • Does this help? https://www.ma.utexas.edu/users/ktaliaferro/gnuplot_examples.html#2var – Ovi Faur Jul 18 '14 at 10:38
  • 4
    You must merge the two files before you can do this, e.g. [Get ratio from 2 files in gnuplot](http://stackoverflow.com/a/20070138/2604213). – Christoph Jul 18 '14 at 10:40
  • 1
    possible duplicate of [Get ratio from 2 files in gnuplot](http://stackoverflow.com/questions/20069641/get-ratio-from-2-files-in-gnuplot) – Christoph Jul 18 '14 at 22:04

1 Answers1

1

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.

Miguel
  • 7,497
  • 2
  • 27
  • 46