# 2.5.8 g2layout

## Brief Information

Add selected graphs to new layout

Minimum Origin Version Required:9.1 SR0

## Command Line Usage

 

1. g2layout option:=open; 

2. g2layout row:=2 col:=2; 

3. g2layout option:=project xgap:=0 ygap:=0; 

4. g2layout option:=specified graphs:="graph1"+char(10)\$+"graph2"; 

## Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Arrange option

Input

int

<auto>

Specifies the graphs to be added in layout

Option list:

• page:Active Page
Add the active graph page into layout
• folder:All in Active Folder
Add all graphs in the active folder, not including those in its subfolder,into layout.
• recursive:All in Active Folder (Recursive)
Add all graphs in the active folder, including those in the subfolders, into layout
• open:All in Active Folder (Open)
Add all open graphs in the active folder into layout, all hidden/minimized graphs are excluded.
• embed:All in Active Folder (Include Embedded)
Add all graphs in the active folder, including those that are embedded in worksheets, into layout.
• project:All in Project
Add all graphs in the current project into layout
• specified:Specified
Add the specified graphs into layout. The Graphs box will be enabled.
Graphs graphs

Input

string

<auto>
If the Arrange variable is set to Specified, user can use this text box to enter the names of the graphs to be added in layout. In this case, the browse button to the right of this text box becomes enabled and you can use it to browse for the graphs to be added. However, if other options are selected for the Arrange variable, this text box will be read-only. You can see the names of the graphs that will be added, but you cannot edit the content of this text box.
Number of Rows row

Input

int

<auto>
Specifies the number of rows in layout. The graphs will be arranged on a row by col grid when added into layout.
Number of Columns col

Input

int

<auto>
Specifies the number of columns in layout. The graphs will be arranged on a row by col grid when added into layout.
Keep Graph Aspect Ratio aspectratio

Input

int

0
Specifies whether to keep the original aspect ratio of the graph windows.
Horizontal Gap xgap

Input

int

5
Specifies the horizontal gap between adjacent windows.
Vertical Gap ygap

Input

int

5
Specifies the vertical gap between adjacent windows.
Left Margin leftmg

Input

int

15
Specifies the left margin to the new graph page.
Right Margin rightmg

Input

int

10
Specifies the right margin to the new graph page.
Top Margin topmg

Input

int

10
Specifies the top margin to the new graph page.
Bottom Margin bottommg

Input

int

15
Specifies the bottom margin to the new graph page.
Orientation portrait

Input

int

0
Specifies the orientation of the layout

Option list:

• landscape:Landscape
Landscape.
• portrait:Portrait
Portrait.
Width width

Input

double

<auto>
Specifies the width of the layout
Height height

Input

double

<auto>
Specifies the height of the layout.
Unit unit

Input

int

<auto>
Specifies the unit of Width and Height.

Note: When the unit selection is changed in the drop-down list, Height and Width text box values are automatically updated so that the layout retains the same size and position. This is not the case when running from script where the values and units should be consistent. Here pixel refers to number of dots where most Origin graphs have 600 dots per inch.

Option list:

• inch:inch
inch.
• cm:cm
cm.
• mm:mm
mm.
• pixel:pixel
pixel.
• point:point
point.

## Description

This X-Function adds the specified graphs into layout. In layout, the source graphs are arranged in a row by col grid

## Examples

In the following example, we add four 3D function plots into a layout.

This Example is associated with the 3D Function Plot: User-Defined 3D Parametric Function Plots folder in the 3D OpenGL Graph project (\Samples\3D OpenGL Graph.opj), which can be opened by selecting Open Sample OPJ: 3D OpenGL Graphs from the main menu

1. From the Origin menu, select Graph: Add Graphs to Layout. This opens the dialog of the g2layout X-Function.
2. In the dialog, make sure All in Active Folder (Open) is choosen from the Arrange drop-down list.
3. Click the OK button in the g2layout X-Function dialog to close the dialog of the X-Function and perform adding the graphs to layout
 You can add equation of the 3D function plots to layout by selecting Insert Equation button, from the Tools toolbar