Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scale measurement data

I have some measured data, experiment.dat which goes like this:

1 2
2 3

Now I want to plot them via some command line

plot "experiment.dat" using 1:2 title "experiment" with lines lw 3

Is there some way how to scale the different lines with some scaling factor like -1?

like image 764
YaY Avatar asked Jul 13 '26 01:07

YaY


2 Answers

Yes, you can do any kind of calculations inside the using statement. To scale the y-value (the second column) with -1, use

plot "experiment.dat" using 1:(-1*$2)
like image 153
Christoph Avatar answered Jul 16 '26 07:07

Christoph


You don't need to multiply the column by minus one, you can simply use:

p "experiment.dat" u 1:(-$2)

at least with Version 5.4 works fine.

You can also only use the initial letter of every command.

like image 28
Andrea Angeletti Avatar answered Jul 16 '26 09:07

Andrea Angeletti