Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add data sets with xmgrace

Tags:

plot

xmgrace

I use xmgrace to plot data sets and I would like to add two data sets together.

So I have two files:

data1

1 1
2 4
3 9
...

data2

1 2
2 3
3 4
...

I start xmgrace with

xmgrace data1 data2

Then I see both files plotted. Now I would like to generate a third graph which is just data1+data2 like

1 3
2 7
3 13
...

I know that this is extremely simple, but for some reason I don't understand how that works.

I played with the feature Data->Transformations->Evaluate expression... but I don't know what to select as "Source" and as "Destination".

PS: I know many other ways to reach my goal but I also want to be able to do it with xmgrace.

like image 480
thyme Avatar asked Mar 11 '23 00:03

thyme


1 Answers

This can easily be achieved using the feature Evaluate expression...

xmgrace data1 data2

Click on Data->Transformations->Evaluate expression...

Select any one (say G0.S0) of the two sets (G0.S0 and G0.S1) as the source. Do not select any existing set as the destination if you want the output to a new set. The Formula should read

y=g0.s0.y+g0.s1.y

The evaluateExpression window should look like

Selections

When you Apply, a new set (G0.S3) will be created. You can modify the formula (g1 for graph G1, etc.) to add values across different graphs as well.

like image 141
h k Avatar answered Apr 30 '23 20:04

h k