# 2.10.14 plotbylabel

Plot > 2D : Multi-Panel : Multiple Panels by Label

## Brief Information

Plot a multi-layer graph using column label as group

Minimum Origin Version Required: 8.1 SR0, updated in 8.5.1 SR0
Hiding the graph is available starting with 9.0, controlling gaps between layers is available starting with 2016 SR0.

## Command Line Usage

 plotbylabel iy:=[book1]1!((1,2),(1,3),(1,4)) group:=U plottype:=2 rows:=3 cols:=1; 

plotbylabel iy:=[Book1]1!((1,2),(3,4),(5,6),(7,8),(9,10),(11,12),(13,14),(15,16)) group:=L plottype:=1 rows:=4 cols:=2 hgap:=10 vgap:=10 tmg:=5 bmg:=5; 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Input iy

Input

XYRange

<active>
Specify the input data ranges.
Group By group

Input

string

<unassigned>
Specify the group identifiers for plotting the input data ranges. Or, use the X columns as separators to plot the Y columns into multiple panels.
• For an column label row selected, data with the same group identifier will be plotted into the same layer. When scripting, please refer to Column Label Row Characters for the single character to specify a label row.
• For X column selected, X columns will used as separators to divide the Y columns as multiple groups, and then this groups will be plotted into multiple panels against the adjacent X data.
Plot Type plottype

Input

int

0
Specify a plot type.

Option list:

• line:Line {0}
Line plot.
• scatter:Scatter {1}
Scatter plot.
• linesymb:Line+symbol {2}
Line and Symbol plot.
• column:Column {3}
Column plot.
Number of Rows rows

Input

int

<auto>
The layers will be arranged in an N by M grid. This variable specifies M, the number of rows in the grid.
Number of Columns cols

Input

int

<auto>
The layers will be arranged in an N by M grid. This variable specifies N, the number of columns in the grid.
Horizontal Gap hgap

Input

int

5
Specifies the horizontal gap in % of page size between adjacent layers.
Vertical Gap vgap

Input

int

5
Specifies the vertical gap in % of page size between adjacent layers.
Left Margin lmg

Input

int

12
Specifies the left margin in % of page size to the new graph page.
Right Margin rmg

Input

int

10
Specifies the right margin in % of page size to the new graph page.
Top Margin tmg

Input

int

10
Specifies the top margin in % of page size to the new graph page.
Bottom Margin bmg

Input

int

12
Specifies the bottom margin in % of page size to the new graph page.
Hide Newly Created Graph hide

Input

int

0
Specify whether to hide the newly created graph. Note that this option is hidden in the dialog. One can only assign its value through Labtalk script.

## Description

This X-Function plots multiple XY ranges into different layers according to group identifiers or X column separators. The group identifiers can be specified by Long Name, Units, Comments or any other customized headers.

## Examples

This example is going to plot the unstacked data ranges. First of all, we need to generate the unstacked data by using the wunstackcol X-Function.

1. Import the data <Origin Installation Directory>\Samples\Statistics\nitrogen.txt. (Change the file type in the ASCII dialog to Text File (*.txt) or All Files (*.*) to be sure to get the TXT file and not the DAT file of the same name.)
2. Highlight column B, and then select menu Worksheet: Unstack Columns.
3. In the pop-up dialog, select column A for Group Columns, and the Put Grouping Info. to will use the User Defined Parameters, and set From Group Columns to Long Name.
4. Click OK to generate the data.
5. Highlight all of the columns in the UnstackCols1 worksheet and then select Origin main menu Plot > 2D : Multi-Panel: Multiple Panels by Label... to bring up the plotbylabel dialog.
6. In the dialog, set Group By as plant and Plot Type as Line+symbol. And keep the Number of Rows and the Number of Columns as default (Auto).
7. Click the OK button to plot a graph with four layers, which identified on their Y Axes by the group identifiers -- PLANT1, PLANT2, etc..