Data with grouping information in column(s) is called Indxed Data in Origin. For indexed data, there are 2 ways in Origin to plot data into multiple panels based on grouping information in column:
- Trellis Plot — New feature in Origin 2017. Limitations:All panels are plotted in one layer so all panels must share the same X and Y range.
- Plotgroup X-Function: This can create traditional mulit-layer graph with data in each group in one layer, but it has other limiations:
- It only supports one set of XY column. If user has multiple Y data, needs to plot each as a multipanel graph and then merge them.
- Panels can only be stacked horizontally or vertically and there is an upper-limit of 8 layers. User need to use layer management dialog to arrange layers into MxN panels.
- By default, all Y scales are the same so user needs to activate each layer and rescale Y scale manually.
- Can’t set group column as categorical to control panel orders.
What if user wants to plot the following multi-panel graph with different treatments: Data vary in different treatments and each treatments has two set of data?
Neither of the above works well. Instead, user can first unstack the data to reorganize it and then use Multi-Panels by Label — tool to create such graphs. This blog will show you how to do so.
Please first download the zip file and unzip it. Then open the opj file in Origin.
Go to Data folder. Column F (treatment) is grouping column. Time data in column A is for x data. City and Country data in column B and C are Y data. We are going to plot City and Country Data against Time into a 2×2 panel graph so each treatment is one panel. The resulting graph can be found in the Result folder.
Unstack Columns to Reorganize data
First we need to unstack columns based on treatment since Multiple panels by label method doesn’t accept indexed data,
- Highlight the column A,B,C, which are the XYY data we want to use for plotting. Then select Worksheet:Unstack Columns… . In the pop-up dialog, Data to be Unstacked field is filled with A, B and C columns we selected.
- Set Recalculate to Auto. Under Group Column(s), click the triangle button and select column F. With other settings unchanged, click OK.
- In output sheet, you will see data is unstacked and treatment shows in Comments row of each column.
Create Multiple-Panel Graph by Label
- Highlight all the columns in the resulting worksheet, select Plot:Multi-Panel:Multiple-Panels by Label… . Set the Group Identifier as Comments, Plot Type to Line+Symbol. Set Number of Rows and Number of Columns to 2. Then click OK.
- The resulting graph should look like this. You can see that the Y axis of every plot is auto rescaled.
Change the order of plots
- User may want to customize the order of the panels, such as show Untreated as the 1st layer (upper left layer). You don’t need to manually move layers around in graph or use Layer Management tool. The layer order is controlled by order of unstacked data sheet. And the Unstacked data order is controlled by Treatment column in source sheet.
- Let’s go to the initial worksheet. Right click the header of column F and select Set as Categorical.
- Once a column is set as categorical, Origin will use the categorical order of the text to decide values. Unsorted means using appearance order as categorical order.
- Double click the cell Unsorted to bring up the Categories dialog. Check the Customize Categories(Add, Delete, Set Arbitray Order) checkbox. Then move untreated row to the top of the list. Click OK.
- Now go to the Unstacked columns result worksheet, Time, City and Country data of untreated group shows in the front.
- If you go to the graph window, you will see the order has been changed.
- In our example X values for all treatment is the same. We can link the X axis of layer 2, 3 and 4 to layer1 as straight 1:1 so when we change X scale in one layer, it will also rescale x scales in other layers. Select Graph:Layer Management…. Select Layer 2 to 4 in the left panel and go to Link tab. Set Link To to 1 and X Axis Link to Straight(1 to 1). Then click Apply.
Polish the graph:
- Below are several steps to further format the graph, skip it if you are not interested.
- Drag the legend of the first plot to upper center of the page. Right click Legend box and choose Legend -> Arrange in Horizontal context menu.
- Right click the legend, select Legend: Update Legend… . Set the Auto Legend Translation Mode to @LA: Long Name. Click OK. Delete the legends of all other plots.
- Double-click the first plot to open Plot Details. In the Symbol tab, enable Custom Construction and with the Geometric radio button selected set Shape to circle and Interior to Open. Toward the top of the tab, set Symbol Size to 18, Edge Color to Dark Gray and Fill Color to By Points > Increment and choose Color List = Q3 Candy, from the drop-down list. Go to Group tab, make the change of settings as shown below. Then click OK.
- Repeat the format settings for the other three plots. The final graph looks like below:
where is the unsorted? I can’t find it.
Please look at step 2 in “Change the order of plots”
Right click the group column and choose Set as Categorical context menu. The column will bet set as categorical and a Categorical label row will show. Unsorted shows there. U can double click to open a dialog to define your own order of categories.
Thanks, Snow