2.10.23 plotstack


Menu Information

Plot : 2D : Multi-Panel : Stack

Brief Information

Create a multi-panel stacked graph

Command Line Usage

1. plotstack iy:=((1,2), (3,4)) plottype:=line;
2. plotstack iy:=((1,2), (3,4)) legend:=combine link:=0;
3. plotstack iy:=((1,2),(1,3),(1,4)) plottype:=custom custom:="203 200" number:="1 2";

Variables

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

Input

XYRange

<active>
Specify the input range.
Plot Type plottype

Input

int

0
Specify the plot type.

Option list:

  • line:Line
    Line plot.
  • scatter:Scatter
    Scatter plot.
  • linesymb:Line+Symbol
    Line+Symbol plot.
  • column:Column
    Column plot.
  • template:Use Template
    Use the plot types in the specified template (Specified in Graph Template) for the plots in each layer. Suppose the number of plot types in the specified template is n, and the maximum number of plots in each layer is m. If n is not less than m, the first m plot types in the template will be used. Or all plot types in the template will be used for the first n plots, and the other plots will use the last plot type in the template.
  • custom:Custom
    Use the plot types specified by the custom variable.
Plot Types in Each Layer custom

Input

string

200
This variable is only available when the Plot Type is Custom. It specifies the plot types for the plots in each layer. Each plot type has its own value, separated by spaces embedded in double quotes. Click here to get the value of the corresponding plot type. When the number of specified types is less than the number of plots in the layer, the plot types come from the Template.
Graph Template template

Input

string

stack
Specify the template for the graph page. If the Plot Type is Use Template, the plot types contained in the template will be used. From Origin2018, both *.otpu and *.otp template types are supported.
Orientation portrait

Input

int

1
Specify the orientation for the graph.

Option list:

  • landscape:Landscape
    The orientation for the graph is landscape.
  • portrait:Portrait
    The orientation for the graph is portrait.
Stack Direction dir

Input

int

0
Specify the stack direction.

Option list:

  • vertical:Vertical
    All layers are stacked vertically.
  • horizontal:Horizontal(X-Y Axes Exchanged)
    All layers are stacked horizontally. Note that the X-Y axes will be exchanged.
Layer Order order

Input

int

1
Specify the order to arrange the layers.

Option list:

  • top:Top to Bottom/Left to Right
    The layers will be arranged from top to bottom (when Stack Direction is Vertical) or from left to right (when Stack Direction is Horizontal(X-Y Axes Exchanged)) so that the first layer is on top or on left of other layers.
  • bottom:Bottom to Top/Right to Left
    The layers will be arranged from bottom to top (when Stack Direction is Vertical) or from right to left (when Stack Direction is Horizontal(X-Y Axes Exchanged)) so that the last layer is on top or on left of other layers.
Legend legend

Input

int

1
Specify how to generate the legend for the graph.

Option list:

  • none:No Legend
    There will be no legend in the graph.
  • seperate:Legend for Each Layer
    Separate legend will be generated for each layer.
  • combine:One Legend for All
    Data plots from all layers are included in the legend for the graph.
Link Layers link

Input

int

1
Specify whether to link the layers.
X Axis Link xlink

Input

int

1
This variable is available only when the Link Layers check-box is checked. It specifies how to establish the link between the X axes of all layers.

Option list:

  • none:None
    Does not create link between the X axes scales.
  • straight:Straight(1 to 1)
    Creates a link in which the child layers' X axes mirror the scale values of the parent layer.
Unit unit

Input

int

6
This variable is available only when the Link Layers check-box is checked. It specifies the unit for the layers.

Option list:

  • page:% of Page
    This unit is useful for maintaining the same layer size relative to the page size. When this unit is selected, the left, top, height, and width of the layer are in percentage of the graph page height and width.
  • inch:inch
    When this unit is selected, the left, top, height, and width of the layer are measured in inch.
  • cm:cm
    When this unit is selected, the left, top, height, and width of the layer are measured in cm.
  • mm:mm
    When this unit is selected, the left, top, height, and width of the layer are measured in mm.
  • pixel:pixel
    When this unit is selected, the left, top, height, and width of the layer are measured in pixel.
  • point:point
    When this unit is selected, the left, top, height, and width of the layer are measured in point.
  • link:% of Linked Layer
    This unit allows you to specify the frame dimensions and offsets for a child layer in terms of the dimensions of the parent layer frame. When this unit is selected, the left, top, height, and width of the layer are in percentage of the height and width of the parent layer frame.
Number of Layers layer

Input

int

<auto>
Specify the number of layers. When there is a single X dataset, all Y datasets are plotted to their own layer, and by default, layers equals the number of plots. When there are multiple X datasets, each Y dataset plots against the X dataset nearest to its left, by default. You can customize the default arrangement by manually specifying the number of layers and the number of plots in each layer (Example: plotstack layer:=3 number:="2 2 9"). The number of X columns cannot exceed number of layers.
Number of Plots in Each Layer number

Input

string

1
Specify the number of plots in each layer. You can separate numbers by space to specify the number of plots in each layer one by one. Example: 1 2 3.
Vertical/Horizontal Gap gapy

Input

int

0
Specify the vertical gap (when Stack Direction is Vertical) or the horizontal gap (when Stack Direction is Horizontal(X-Y Axes Exchanged)) between adjacent layers.
Left Margin leftmg

Input

int

15
Specify the left margin of the page.
Right Margin rightmg

Input

int

10
Specify the right margin of the page.
Top Margin topmg

Input

int

10
Specify the top margin of the page.
Bottom Margin bottommg

Input

int

10
Specify the bottom margin of the 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 several ranges into a stacked graph. Plot types can be customized for the plots in each layer and the layers can be stacked vertically or horizontally.

For more information, see Stack Graph in the Origin Help file.

Examples

  • Sample Code
// The plotstack function is used by the Plot : Multi-Curve :
// Stack menu option, but has the additional ability to
// specify a template
newbook;
string fn$ = system.path.program$ + "Samples\Graphing\Linked Layers 1.dat";
impasc fname:=fn$;
%N = %H;
// Create a Stack plot of all columns vs column 1
plotstack iy:=(1,2:end) plottype:=line link:=1 xlink:=1;

// Create stack plot of column 2 vs. column 1 and column 4 vs. column 3
win -a %N;
plotstack iy:=((1,2), (3,4)) plottype:=column link:=0;

// We can specify a template to use, but this template should be a single layer template
// as the function loads one instance of the template for each dataset.
// Plot Type should match your template if you wish to use its style holder.
win -a %N;
plotstack iy:=((1,2),(1,3),(1,4)) plottype:=3 template:=column;

// Now minimize all worksheets and tile remaining windows
doc -e W {
    win -i;
}
win -s T;  //Tile the windows horizontally

Related X-Functions

newpanel