2

I have a data file that I plot using

    plot 'data.dat' u 1:2 smooth csplines

and I want to reuse this function to get the ratio with another data file function. The x points for the two functions are different so I need to have the smoothed function with the entire information over any x-point to construct the ratio at an arbitrary x. Is possible to define the plotted smoothed function as a function over reals?

bluePhlavio
  • 537
  • 5
  • 18

1 Answers1

1

You can save the smoothed functions to an external file. You must make sure that both smoothed functions are interpolated over the same xrange and with the same number of samples:

set samples 500
set xrange [] writeback

set table 'data-smoothed.dat'
plot 'data.dat' using 1:2 smooth csplines
unset table

set xrange restore
set table 'data2-smoothed.dat'
plot 'data2.dat' using 1':2 smooth csplines
unset table

plot '< paste data-smoothed.dat data2-smoothed.dat' using 1:($4/$2)

If you're working on Windows, you may want to use the litte script paste.py shown in Get ratio from 2 files in gnuplot to merge the files.

Community
  • 1
  • 1
Christoph
  • 47,569
  • 8
  • 87
  • 187
  • Wow just what I was searching for! Thank you very much! – bluePhlavio Jul 14 '14 at 20:37
  • @Christoph. Hi, is there a way to print/plot _directly_ the differences between the data points and the smoothed curve ones? And an equivalent of the chisquare? - I guess it is possible to print on a table then to interpolate, etc etc... – Hastur Feb 21 '20 at 21:51