4.1.6 Cluster Gadget


Summary

Origin supports the Cluster Gadget to perform simple statistics on a region of interest (ROI) in a graph. The gadget can also be used to edit, clear, mask, or categorize data points. The statistics results are dynamically updated as the ROI object is moved or resized.

Minimum Origin Version Required: Origin 2016 SR0 (Pro only)

What you will learn

  • How to perform simple statistics on a region of interest (ROI) in a graph.
  • How to edit the data points such as clear, or mask points in graph using menu options or buttons.
  • How to view or output the statistic for points inside and outside of the ROI.
  • How to categorize data points and color map points with the categorical data

Perform basic statistics

  1. Start with a new workbook and import the Origin sample data Categorical Data.dat which is located in <Origin Program Folder> \Samples\Graphing.
    Right-click on Col(D) and select Sort Worksheet: Ascending. Then you will see the worksheet is sorted by the category of Drug.
  2. Pressing Ctrl key, highlight three parts of the Col(B) separately.
    Cluster Gadget 01.png
  3. Select Plot: Basic 2D: Scatter from the main menu to create a graph. The graph with three plots display the recovery for each drug.
    Cluster Gadget 02.png
  4. Right-click on the graph legend and select Properties to open Object Properties dialog. Then edit the legend as shown below. Click OK button.
    Cluster Gadget 10.png
  5. Select Gadgets: Cluster from the Origin menu to bring up the Cluster: addtool_cluster dialog box. Choose Circle in the Shape drop-down list of the ROI Box tab.
    Cluster Gadget 03.png
  6. Click OK button. It will add a yellow circle for ROI on the plot and bring up the Cluster Gadget dialog.
    Cluster Gadget 04.png
  7. Move the yellow circle to the region for which you want to get statistics and see the results shown on the Inner Points tab of the dialog.
    Cluster Gadget 05.png
  8. Click the Output Statistics Report buttonButton Output Statistics Report.png. The results are output to the Result Log, Script Window, and the Cluster workbook.
  9. Click the Go to Report Worksheet buttonButton Go To Report Worksheet.png, then the Cluster workbook will be shown.
    Cluster Gadget 11.png

If you have Origin 2021b or later, you have more options for the ROI shape. In the addtool_cluster dialog, set Shape to Arbitrary Shape. When you click OK, a small Create ROI dialog opens in which you can click on a shape button and -- without closing the Create ROI dialog -- drag out a shape on your graph. Keep this dialog open until you get the ROI that you want and then click Done. That will open the Cluster Gadget.

Also note that the Cluster Gadget toolbar now has buttons to Modify ROI and Add New ROI (for adding multiple ROIs to the graph).

OH cluster gadget tip figure.png

Exclude the data points in a cluster

In this section, we will show you how to exclude a specific plot from the cluster. Based on the example above, we will do simple statistics on Recovery of Drug A and Recovery of Drug B, excluding Recovery of Placebo.

  1. Click the Data menu in the Cluster Gadget dialog and uncheck Plot(1) and Plot(2). The first and second rows become gray in the lower panel, and they can no longer be manipulated by the buttons in the dialog.
  2. Click Mask Data Points buttonButton Mask Data Points.png. The Recovery of Placebo data points in the ROI are masked and the color becomes red. At the same time the statistics results for Recovery of Placebo become missing values.

    Cluster Gadget 07.png

  3. Click the Output Statistics Report buttonButton Output Statistics Report.png. The results are output to the Result Log, Script Window, and the Cluster workbook.

Get statistics results for points outside of the ROI

  1. Click Settings: Preferences from the Cluster Gadget dialog's menu to open the Cluster Manipulation Preferences dialog.
  2. Go to the Calculation tab. Check the Calculate Outer Points box.
    Cluster Gadget 08.png
  3. Click the OK button, the statistics results for points out of the ROI are shown on the Outer Points tab of the dialog.
    Cluster Gadget 09.png
  4. Click the Output Statistics Report buttonButton Output Statistics Report.png. The results for inner and outer points are shown in the Result Log, Script Window, and the Cluster workbook.

Color data points in different regions

You can categorize data points from graph directly and output the Categorical group column to the source worksheet, and further map symbol characters to the categorical group column.

Create a new workbook and re-import the sample data <Origin Program Folder>\Samples\Graphing\Categorical Data.dat. Highlight Column(B) and plot a Scatter graph.

Cluster Gadget 12.png

Data points cluster into 4 groups. We will use the Create Categories feature of Cluster Gadget to create a categorical column according to the cluster groups and map symbol color to this column.

  1. Select Gadgets: Cluster to bring up the Cluster: addtool_cluster dialog. Choose Circle in the Shape drop-down list of the ROI Box tab.
    Click OK button to add a yellow circle for ROI on the plot and bring up the Cluster Gadget dialog.
  2. Move and adjust the size of the ROI box to circle only the first cluster of data points at the low-left corner.
    Cluster Gadget 13.png
    Click the Create Categories button Button Create Categories.png on the Cluster Gadget dialog to open the Create Categorical Value dialog. Enter Group for Category Group Name and 1 for Category. Select the Color Data by Category check box.
    Cluster Gadget 14.png
    Click the OK button. A new categorical column named "Group" is added to the source data sheet and data points inside ROI are tagged as "1" in this column(Group). Also, scatter plot use this categorical column as the color index.
    Cluster Gadget 15.png
  3. Repeat step 2 for the rest of 3 clusters and tag them as 2, 3, 4 in sequence.
    Cluster Gadget 16.png
    The source worksheet should look like the following.
    Cluster Gadget 17.png
    Close the Cluster Gadget.
  4. Now you will find the graph shows as below:
    Cluster Gadget 19.png
  5. Delete the original legend. Select Graph: Legend: Categorical Values to bring up the legendcat dialog. Uncheck the Show All Categories checkbox. Click OK. The scatter plot with new legend should look like following.
    Cluster Gadget 20.png