How can I plot a function of data with xmgrace?
Let's say I have a 3-columns file and I want to plot the sum of 2nd and 3rd column as a function of the 1st. With gnuplot, I can just do
p "file.dat" u 1:($2+$3)
How can I do the same thing with xmgrace?
awk '{print $1, ($2 + $3)}' file.dat | xmgrace -pipe &
Example: Plot data for y = x^2 + 4
Contents of file.dat:
0 0 4
1 1 4
2 4 4
3 9 4
4 16 4
5 25 4
6 36 4
Output (after modifying styles):

A pure grace solution would be to create a batch file (say myplot.batch) that reads
READ BLOCK "file.dat"
BLOCK xy "1:2"
BLOCK xy "1:3"
s0.y=s0.y-s1.y
KILL s1
And execute using
xmgrace -batch myplot.batch
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With