Search code examples
windowsgnuplot

gnuplot - plot difference between two columns with pseudocolumn 0


I have a .csv file organized as follows:

425;490
160;343
390;487
35;231
...

I want to plot the difference of (row1-row2) on the y-axis, and the pseudocolum 0 as the x-axis.

So far, i've tried

plot "test.txt" using $0:($1-$2)

which throws

column() called from invalid context

On the other hand

plot "test.txt" (using $0:($1-$2))

seems to work but throws

'plot "test.txt" (using $0:($1-$2))'

in the console.

So my question: What would be the correct syntax?


Solution

  • plot 'text.txt' using 0:($1-$2)
    

    or

    plot 'text.txt' using ($1-$2)