Search code examples
xmgrace

Evaluate expression: how to also modify error bar values


Given a set of points with vertical error bars, if I simply apply a transformation on them through Data > Transformations > Evaluate Expression (such as y=y/5) only the points themselves are transformed, but not the error bars.

How can I apply the same transformation on the error bars as well? I would prefer a method that transforms simultaneously both the values and the error bars.


Solution

  • If you double click on the source dataset, you can see the name of the columns that are used for the error bars. In the case of a XYDY dataset, the third column will be called y1. You can use that name in any expression. For instance,

    y1 = y1/2
    

    will generate a new dataset with errors reduced by a factor of 2. You can change write down expressions that change both y and y1 at once by separating them with semicolons:

    y = y / 2;
    y1 = y1 / 2