Search code examples
xmgrace

Xmgrace: plot function of data


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?


Solution

  • 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):

    Plot of y = x^2 + 4