OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis                           
 

2.2.26 subtract_line

Menu Information

Analysis: Data Manipulation: Subtract Straight Line

Brief Information

Subtract straight line from a data plot

Command Line Usage

subtract_line x1:=0 y1:=0.5 x2:=200 y2:=3.5;

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input iy

Input

XYRange

<active>

Specifies the input data that will be subtracted.

X1 x1

Input

double

0

Specifies the X value of the first point.

Y1 y1

Input

double

0

Specifies the Y value of the first point.

X2 x2

Input

double

<unassigned>

Specifies the X value of the second point.

Y2 y2

Input

double

<unassigned>

Specifies the Y value of the second point.

Output oy

Output

XYRange

<input>

Specifies the output range for the subtracted data.

See the syntax here.

Description

This X-Function can be used to subtract a straight line from a data set. The straight line is determined by two points. If you use this X-Function from the menu and a graph is active, you can click on the graph to select these two points. If you use this X-Function from script, you can specify the X and Y values of these two points.

Examples

  • Code Sample
// In this example of the subtract_line X-Function, we will subtract a straight line created by the endpoints of a curve
// Import our sample dataset
newbook;
path$ = system.path.program$ + "Samples\Spectroscopy\Raman Baseline.dat";
impasc fname:=path$;
// define ranges for X and Y and an XY range
range rx = 1;
range ry = 2;
range rxy = (1,2);
range rxynew = (3,4); // columns do not exist yet
// Plot our data
plotxy rxy plot:=201 color:=color(blue);

// Use the X and Y ranges to get the endpoints and subtract into new columns and plot
subtract_line iy:=rxy x1:=rx[1] y1:=ry[1] x2:=rx[rx.nrows] y2:=ry[ry.nrows] oy:=<new>;
plotxy rxynew color:=color(orange) plot:=201 ogl:=1;

// Add the line used for subtraction - before and after subtracting
draw -n subline1 -l {rx[1],ry[1],rx[rx.nrows],ry[ry.nrows]};
subline1.color=2;
draw -n subline2 -l {rx[1],0,rx[rx.nrows],0};
subline2.color=1;

Related X-Functions

subtract_ref


Keywords:baseline correction, subtraction

 

© OriginLab Corporation. All rights reserved.