How do I divide one column in gnuplot?

Solution 1:

Assuming that the x values are in the first column of the file 'test.dat' and the y values are in the second column of the same file, then you can write:

plot 'test.dat' using ($1/n):($2)

See the manual for more information and examples on the 'using' keyword.

Note that this will not change the values of your data file 'test.dat'. If you prefer to rewrite the data file, you can do it using awk. For example:

awk '{print $1/n,$2}' test.dat > testnew.dat

will substitute the x values in the first column of test.dat with x/n and will generate a new file called testnew.dat.