This post will show you how to mask data points on a graph and extract masked points to a new workbook automatically. When you mask or unmask more data, the workbook will be updated automatically.
We have put together a sample OPJ file in Extract_Masked_Data_Points.zip (12.2 KB) file. To learn how to make this graph, you can download this file, extract the contents and open the OPJ file. You should see the workbook Source Data which contains column X for X data and column Y for Y data, and Graph1 which is a scatter plot of Y versus X.
!!! Note: In Origin 2019 and later, you can use data highlighter tool to select masked points and then create subset. E.g.
- Click the Data Highlighter toolbar button on left side of workspace.
- Drag rectangle to select the masked points.
- Ctrl+key to continue the selection. –> You will see the corresponding row in worksheets are highlighted as well.
- Press ESC to finish data highlighting. –> Rows are still highlighted in worksheet.
- Right click highlighted data and choose Create Subset Sheet. –> A new sheet is created with highlighted points.
In both Origin 2019 and earlier versions, you can follow the following procedures to extract masked data points automatically.
Mask Desired Data Points on Graph
- With Graph1 window active, click button on Regional Mask toolbar on the left side of Origin workspace, Single click on data point to mask it. Usually it change color. You can also drag a region to mask all points inside the region.
- The corresponding datas in worksheet will also change color to indicate they are masked. See the source sheet’s Red cells.
Extract Masked Data Points Automatically
To extract the masked data to a new workbook, let’s use Worksheet Query tool.
- Activate Source Data workbook, go to menu Worksheet: Worksheet Query… to bring up the dialog.
Select Y in Columns: list and click button to make it show under Select Column Variables for If Test table since we want to extract data based on mask status of Y data.
Enter the following condition in Condition: edit box:
isMasked(i,Y) // i is built-in row index variable, Y is the Alias name.
- Before actually extract out the data points, we can click button Test — select if true button to highlight data rows that matched with the entered condition.
- Once we confirmed the results, we can extract the data points to a new workbook by selecting Extract to New Workbook radio box in Output group. To keep the results updated for any change in later process, we can select Recalculate mode as Auto.
- Click OK button to extract data points.
- Because the Recalculation mode is set to Auto, When you unmask or mask more points, the workbook will be updated automatically.