This post will show you how to stack multiple lines into groups and offset the grouped lines constantly along Y direction.
We have put together an OPJ file in Stack_lines_with_Y_offset.zip (201 KB) file, which is raw data kindly provided by sir Matt Siebecker. To learn how to make this graph, you can download this file, extract the contents and open the OPJ file.
You should see a workbook Stack Lines with Y Offset with all data highlighted and a reference graph Graph1 that we are going to make. From Graph1, we should see that:
- The stacked lines are grouped in unit of 2 and offsetted by a constant distance along Y.
- The line style within a group is repeated: Solid Line, Short Dash, and the dashed line is always colored Red. The solid lines across different groups are colored in a pattern: Black, Gray, Royal.
- The legend entries are grouped in unit of 2 and each group is constantly separated with other group. The positions of legend entry groups are positioned to match up with related line group.
- The axis titles used Greek letters.
In the following sections, we will show you how to customize the graph as mentioned above.
Stack Lines in Groups with Constant Y Offset
1. With all columns in SampleData sheet highlighted and book Stack Lines with Y Offset active, click button or go to menu Plot: Line: Line to make a line plot.
2. Double click on the graph to open Plot Details dialog, highlight Layer1 node on the left panel and go to Stack tab on the right panel.
3. Check Constant radio box in Offset group and input 0, -5 in the edit box to offset all curves in the pattern: 0 0 -5 -5 -10 -10, etc.
4. Click Apply button to see the effect.
5. The curves are offsetted downwards, so we need to reset the Y range to fit the graph. Double click on the Y axis to bring up axis dialog Y Axis – Layer 1, and set From to be -142 under Scale tab.
6. The curves are also clipped with within 3 to 12 along X, to set it click Horizontal icon on the left panel to switch to X axis and set From as 3 and To as 12. Set major tick increment as 1 in Value edit box under Major Ticks node.
7. We also want to add major and minor grid lines along Y direction as LT Gray. Now click Grids tab in the axis dialog, check both Show checkboxes for major and minor grid lines. Set color of major grid lines as LT Gray and minor grid line Thickness as 0.5.
8. Now we need to hide ticks and tick labels on left Y but show them on Top X. To do so click Line and Ticks tab, click Top icon on left panel and check Show Lines and Ticks checkbox. Click Left icon on the left panel and set the Style of Major Ticks and Minor Ticks as None. Then click Tick Labels tab, uncheck Show checkbox to hide tick labels.
Set Line Styles of Stacked Lines
1. Double click on the graph to bring up Plot Details dialog and highlight the first data plot under Layer1 node.
2. With Group tab active, click more options button under Details heading in Line Color row to bring up Increment Editor. Set the Line Color list as shown below:
3. Click OK to exit the dialog. Now select By One as Increment style for Line Style. Click more options on that row to bring up Increment Editor dialog for line style. Set the Line Style as shown below:
4. Click OK to exit dialog. Now go to Line tab and set line Width as 1. Click OK button to apply the settings and exit Plot Details dialog.
Align Legend Entries with Stacked Line Groups
1. First we need to resize the graph to a proper size and shape by single clicking on the graph and dragging the appeared green handles.
2. We want no borders for legend entries and every two sequential entries as a group. To do so, right click on the legend to select Properties… and open Object Properties dialog.
3. Select (None) from Background drop-down list. Hit Enter key between every two legend entries to insert an empty line to separate legend groups.
4.Click OK button to apply effects and exit dialog. Now we need to resize the legend to match the height of graph, to do so click on the legend and drag the appeared top right green handle to roughly adjust its size.
5. Now we can move the legend object so that the first legend entry group matched up with the first stacked line group. After that, to fine tune the position and size we can click on the legend again and this time hold Ctrl key to drag the bottom right green handle to force the last legend entry group horizontally align with the mean position of last stacked line group.
Tip:
If you want to separate the legend entries into two columns, you can click on the legend and hold Ctrl key to drag the middle right green handle horizontally towards right until the legend entries get separated.
Insert Greek Letters into Axis Title
1. To change Y axis title, right click on Y axis title and select Properties… to open Object Properties dialog. Input the following into the edit box:
\f:Times New Roman(\(x03C7)) (\i(k)\f:Times New Roman(\(41)\f:Default: Arial(x))\i(k)\+(3)
2. Similarly, for X axis input the following into the edit box:
\i(k )(\f:@Arial Unicode MS(\(a197))\+(-1))
To learn more about how to insert Greek symbols and other special characters into a graph, please read this Quick Help.