4.5.4 Categorical Values Ordering and Sharing

Video Image.png Video Text Image.png Website blog icon circle.png Blog Image 33x33px.png


Categorical values are used to store categories information in a column. In Origin, you have the capacity to manually add, remove, order categories in a column and the categorical information stored in the column will be carried over to result sheet during analysis. You can easily save categories into a text file and share across columns or worksheets.

Minimum Origin Version Required: Origin 2015 SR0

What you will learn

  • How to manipulate categorical values
  • How to order categorical map
  • How to share categorical values

Manipulate Categorical Values

  1. To import the Origin sample data, select Data: Import from File: Excel(XLS, XLSX, XLSM...) from the Origin menu. Browse to <Origin Program Folder>\Samples\Statistics and select HouseholdCareSamples.xls. Click the Add File(s) button. Make sure that the Show Options Dialog: check box is selected. Click the OK button to open the impMSExcel dialog.
  2. Specify the following settings in the impMSExcel dialog:
    • Under File Info, expand the HouseholdCareSamples.xls branch. Unselect File Sheet(s), then check the check boxes next to HQ Family Mart and TX Trust-Mart.
    • In the Header Lines branch, select 1 in Number of Subheader Lines drop-down list and then 1 for Long Names. Check Apply Header to All Sheets box.
    • Click OK to import the data into Origin.
  3. On the HQ Family Mart worksheet, highlight column Category (long name) and right click to select Set As Categorical. Double click on the Unsorted on Categories label row to bring up Categories dialog.
  4. Now we want to only keep Household Clean, Kitchen Clean, Dishwashing Liquid, Laundry Powder and Fabric Conditioner five categories and order them as listed. To do so, first check Customize Categories (Add, Delete, Set Arbitrary Order) box, hold Ctrl key to select unwanted categorical values and use Remove button Category Tab Button Delete 92.png to remove them.
    Categorical Values Ordering Tutorial 02.png
  5. Drag the row headings or use the Category Tab Button ToTop 92.png, Category Tab Button Move Up 92.png, Category Tab Button Move Down 92.png and Category Tab Button ToBottom 92.png buttons to reorder, as shown below:
    Categorical Values Ordering Tutorial 03.png
  6. Then click Save > button and select Save As to bring up Categories Save as dialog. Enter HouseholdCare Category as Name and click OK to save the categorical values in a text file under displayed Save Path for sharing later.
    Categorical Values Ordering Tutorial 04.png
  7. Click OK to close Categories dialog box.
  8. Next we want to know the total number of items in each of the five categories specified in step 4 and make a column plot of results. To do so, highlight column Number (long name) and go to Statistics: Descriptive Statistics: Statistics on Columns: Open Dialog... to bring up Statistics on Columns dialog, click right-sided triangle icon on Group row to select E(Y):Category as grouping column and click OK to close the dialog. In the prompt dialog, click OK.
  9. Switch to DescStatsQuantities1 flat sheet, select column N total (long name) and go to Plot: 2D: Bar: Column to create the column plot.
  10. Double click on the X axis tick labels to bring up Tick Labels page on Axis dialog, go to Format tab and select 45 from Rotate (deg.) drop-down list and click OK to close the dialog.
  11. Double click on the graph to bring up Plot Details dialog, expand Layer1 node to go to its subnode. In the Pattern tab, expand the Color drop-down list in the Fill group, select By Points tab, and choose the color Black under Increment from list to set it as the starting color. Click OK to close dialog.
    Categorical Values Ordering Tutorial 04a.png
  12. Right click on the page and select Fit Page To Layers... and click OK in the appeared dialog to bring the X axis label into page. Delete the legend, use Text tool to add HQ Family Mart as graph title. Move X axis title and added graph title to proper positions, and the column plot looks like the following:
    Categorical Values Ordering Tutorial 05.png

Beginning with Origin 2020b, you can toggle between display of Categories and Category Index in the worksheet column by clicking the Show Category Indices button on the worksheet page-level Mini Toolbar.

Share Categorical Values

  1. Continue from the section above, now we want to share the categories saved earlier with second worksheet TX Trust-Mart. To do so, activate TX Trust-Mart sheet and highlight column Category (long name) and right click to select Set As Categorical.
  2. Double click on the Unsorted on Categories label row to bring up Categories dialog, check Customize Categories (Add, Delete, Set Arbitrary Order) box and click Load > button on the right and select appeared HouseholdCare Category file.
    Categorical Values Ordering Tutorial 06.png
  3. Follow steps 7-12 in above section and add text TX Trust-Mart instead of HQ Family Mart in step 12, we will obtain a column plot from TX Trust Mart source sheet as following:
    Categorical Values Ordering Tutorial 07.png