Analyze g Subtract two selected plots

Subtracts one selected plot from another. This only works when exactly two plots are selected.

A hand-drawn backgound is subtracted from a measurement

Analyze g Add 2 selected plots

Adds one selected plot to another. This only works when exactly two plots are selected. The upper selected plot will be source plot 1 of the algorithm.

Calculating with  two selected plots: the algorithm

The algorithm first determines the common range of the two plots. For this common range, it takes each point of source plot 1 (SP1) and interpolates the y value of source plot 2 (SP2) on the exact x location of the SP1-point. It then performs the applicable calculation (subtraction, division, whatever was selected) on the original SP1 y value and the interpolated SP2 y value. The result is placed in a third plot, the destination plot (DP), on the exact same x location as the data point of SP1. The DP thus contains exact as many points as SP1 (in the shared range of the two plots), on the exact same x-locations.

If SP2 contains many more data points than SP1, then the resolution SP2 would become lost if it were calculated like this. In order to prevent the loss of resolution, SP1 is temporarily upsampled if it contains less than half the data points of SP2 in the shared range.