14
votes

I want to add an offset to the data from a file which i want to plot using gnuplot. Suppose i want to add an offset of 0.001 to all the data values from file before i plot them . How can i do it in gnuplot without having to rewrite the data file with the offsets.

Thanks.

2

2 Answers

21
votes

Try something like this:

plot "Data.dat" u ($1):($2 + 0.001) w l

The $1 and $2 specify the column you want to plot. Simply add a constant like 0.001 to the column or even add two columns like so: $1 + $2.

I hope that answers your quastion
Cherio Woltan

3
votes

I think it is better to let gnuplot compute offset, instead of guessing the right constant...

off(x) = sin(x) + offset
fit off(x) "data" using 1:2 via offset
plot off(x)