3.3.2.55 Set

Brief Introduction

Change the attributes of the specified dataset, data plot, or worksheet.

Syntax

set name [option] [value];

Specifying Worksheet, Dataset or Data Plot

We usually specify worksheet, dataset or data plot by name.

  • If name is a worksheet, all datasets on the worksheet are affected.
  • If name is a dataset or data plot, only that dataset or data plot is affected.

As of Origin 2017, name can refer to multiple plots of the same worksheet dataset, using a Book_N:n syntax. For the following example, create Book1 and fill columns A and B with row numbers in rows 1 - 32:

plotxy iy:=(1,2)[1:16] plot:=201 color:=1; // creates a scatter plot
%A = %H; // puts the active window title into %A
win -a Book1; // activates Book1
plotxy iy:=(1,2)[17:32] plot:=201 color:=2 ogl:=[%A]1!; // adds plot 2 to the graph and sets color to red
win -a Graph1; // activates Graph1
set Book1_B -z 24; // changes symbol size of plot 1 to 24;
set Book1_B:2 -z 24; // changes symbol size of plot 2 to 24

Specifying Data Point

We can specify the data point by providing a number after the dataset name. For example:

set %C 13 -c 2;    //This sets the color of 13th datapoint to Red
Note: This datapoint notation can be only applied to the following options:
Scatter/Symbol+Line Related Option -z , -c , -cse , -csf , -k , -ka , -kf , -lh , -lhc , -lhs , -lhw , -lv , -lvc , -lvs , -lvw
Bar/Column Related Option -pbc , -pbs , -pbw , -pfb , -pfc , -pfp , -pfw

Specifying Pattern

From Origin 2017 SR1, if you want to set the pattern properties for a multiple pattern plot, you can specify the pattern index after “p” in option directly. That is to say, p is the first pattern, p2 is the second pattern, p3 is the third pattern and etc.For example:

set %C -pf 1; // Turn on '''Fill Area Under Curve''' option
set %C -pfv 9;// Set to '''Fill to next data plot – Above Below Colors'''
set %C -pfb 2; // Set the fill color of “Pattern Above”
set %C -p2fb 3; // Set the fill color of “Pattern Below”
Note: This pattern notation can be only applied to the following options:
Bar/Column Related Option -pfb, -pfc, -pfm, -pff, -pfp, -pfw

Options

The option switch determines which attribute is set to value. (Read these attributes with the get command.) Some of the values have a built-in list in Origin (color, shape, etc.), user can use the index number to complete the set, indicated by value#.

Option for Columns

Option Description
no option Open the Plot Details dialog box
-at Do not save the dataset with the project
-b Set the beginning of the data display range
-b3o Set the start value from which the 3D Bars are drawn
-bs Temporarily set the beginning of the range of a dataset to the index given by value
-dc Set the dataset as categorical
-e Set the end of the worksheet display range
-e Reset the data plot to the full range
-em Set the end of the worksheet display range
-er Set the number of rows available on the named worksheet
-es Temporarily set the end of the range of a dataset to the index given by value
-ez Set the end of the worksheet display range
-f Set the corresponding X value for the first data point
-f1 Set the function to plot from xvalue
-f2 Set the function to plot to xvalue
-hbb Set the begin value of the histogram bin data
-hbe Set the end value of the histogram bin data
-hbs Set the histogram bin size
-i Set the X increment for the dataset
-it Set the internal data type for the name dataset or matrix to the value dataTypeValue
-set Force Text & Numeric datasets to show numeric values as text elements

Option for Data Plots

Option Description
-a Set the plot to the animate mode to be used for animation
-an Turn on or off the animate mode
-b3c Set the color map of surface plot to be from the specific matrix
-b3t Set the fill mode of the 3D surface plot
-b3cc Set individual color as 3D surface plot color fill
-b3cm Set matrix as 3D surface plot color map
-b3cn Set matrix as 3D surface plot color index
-b3cn Set matrix as 3D surface plot color with direct RGB
-b3m Set the mesh on 3D surface plots
-c Set plot line color and symbol edge color, or map color to a dataset of index values
-cf Set the fill color following the color palette
-ci Set plot line and symbol edge color to increment, and choose starting color index
-cl Set the plot line color following the color palette
-cli Set the plot line color to be increment
-clm Set the plot line color to be colormap
-cln Set the plot line color to be indexing
-cm Set the plot line color and symbol edge color to be colormap
-cmc Fill to contour lines or grid lines on matrix based contour plots
-cmd Show data points on workbook based contour plots
-cmf Show color fill on contour plots
-cmg Show grid lines on workbook based contour plots
-cn Set the plot line color and symbol edge color to be indexing
-clr Set the plot line color to be RGB
-cpal Set the color palette to the data plot or matrix
-cr Set the plot line color and symbol edge color to be RGB
-cse Set the plot symbol edge color following the color palette
-csei Set the symbol edge color to be increment
-csem Set the symbol edge color to be colormap
-csen Set the symbol edge color to be indexing
-cser Set the symbol edge color to be RGB
-cset Set the plot symbol edge color pattern
-csf Set the plot symbol fill color following the color palette
-csfi Set the symbol fill color to be increment
-csfm Set the symbol fill color to be colormap
-csfn Set the symbol fill color to be indexing
-csfr Set the symbol fill color to be RGB
-cu Set the custom increment color list for plotted line
-cue Enable or disable custom colors in data plots. When disabled, you are limited to using the original LabTalk list of colors.
-cuf Set the custom increment color list for pattern fill
-cus Set the custom increment color list for symbol edge
-cusf Set the custom increment color list for symbol fill
-czn Set the Z level for level n in a color mapped data plot
-gtl Set the gap between leader line and label (also the gap between leader line and symbol)
-lczm Removing missing values in Z for XYZ contour/surface
-md Plot-level override of global and page mask
-pc Modify plot data to skip columns by the specified start column and increment
-r Delete special points, selectively or all
-so Access the original plot for 3D scatter or trajectory plots
-spi Set the index column for triangle patch
-sx Set the X offset
-sx Access the YZ projection for 3D scatter or trajectory plots
-sxs Set the scaling factor of X value after stacking for a data plot
-sy Set the Y offset
-sy Access the XZ projection for 3D scatter or trajectory plots
-sys Set the scaling factor of Y value after stacking for a data plot
-sz Access the XY projection for 3D scatter or trajectory plots

Option for Symbols

Option Description
-k Set plot symbol shape (Built-in symbols)
-ka Set plot symbol shape (user-defined and ASCII)
-kf Set plot symbol interior
-kh Set plot symbol Edge Thickness
-ki Set plot data symbols to italic
-kn Set plot font for alphanumeric symbols
-ku Set plot data symbol to underline
-kt Symbol tab Construction details radio choices
-z Set data point symbol size
-ksi Set symbol shape increment
-kfi Set symbol fill type increment
-ksn Set indexing symbol
-kfn Set indexing fill symbol
-kss Set single symbol

Option for Lines

Option Description
-d Set the line style
-dn Set indexing line style
-l Set plot line connection method
-lhc Set the horizontal drop line color
-lhs Set the horizontal drop line style
-lhw Set the horizontal drop line width
-lvc Set the vertical drop line color
-lo Show/hide drop lines on Z direction
-lh Show/hide drop lines on X direction
-lv Show/hide drop lines on Y direction
-lvs Set the vertical drop line style
-lvw Set the vertical drop line width
-wn Set indexing line width

Option for Text Labels

Option Description
-tf Set the text label font
-tj Set text label justification
-tr Set the text rotation in angle
-ts Set text label font size
-tts Set what kind of text is going to be displayed for text label
-tx Set the Y offset for the plot data label
-ty Set the X offset for the plot data label

Option for Bar and Column Plots

Option Description
-pbc Set plot bar or column border color
-pbci Set bar or column border color as Increment
-pbcm Set bar or column border color to be colormap
-pbcn Set bar or column border color to be indexing
-pbcr Set bar or column border color to be RGB
-pbs Set plot bar or column border line style
-pbw Set plot bar or column border line width
-pfb Set plot bar or column fill color
-pfbi Set bar or column fill color as Increment
-pfbm Set bar or column fill color to be colormap
-pfbn Set bar or column gradient fill color to be indexing
-pfbr Set bar or column gradient fill color to be RGB
-pfc Set plot bar or column fill pattern color
-pfci Set bar or column pattern color as Increment
-pfcm Set bar or column pattern color to be colormap
-pfcn Set bar or column pattern color to be indexing
-pfcr Set bar or column pattern color to be RGB
-pff Set bar or column gradient fill color
-pffi Set bar or column gradient fill color as Increment
-pffm Set bar or column gradient fill color to be colormap
-pffn Set bar or column gradient fill color to be indexing
-pffr Set bar or column gradient fill color to be RGB
-pfm Control the mode of gradient fill
-pfp Set plot bar or column fill pattern
-pfpd Set bar or column fill pattern as Indexing
-pfpi Set bar or column fill pattern color as Increment
-pfpn Set bar or column fill pattern by patter file name
-pfw Set plot bar or column fill pattern line width
-vg Set the bar and column plot gap
-vw Set the bar and column plot border width (in points)

Option for Error Bars

Option Description
-o Plot the values in the name dataset as Y error bars for the plotted Ydataset
-om Plot the values in the name dataset as Y (minus) error bars for the plotted Ydataset
-op Plot the values in the name dataset as Y (plus) error bars for the plotted Ydataset
-or Plot the values in the name dataset as Y error bars (relative) for the plotted Ydataset
-ox Plot the values in the name dataset as X error bars for the plotted YDataset
-oxm Plot the values in the name dataset as X (minus) error bars for the plotted YDataset
-oxp Plot the values in the name dataset as X plus (error) bars for the plotted YDataset

Option for Data Plot Labels

Option Description
-lm Extend plot line when there are missing values
-q Turn the data label on or off
-qa Turn the Auto Orientation of label on or off in 3D graph
-qb Set the data label to bold
-qc Set the data label font color
-qf Set the data label font
-qi Set the data label to italic
-ql Set the connection type of leader lines on OpenGL 3D graph
-qlc Set the color of leader lines on OpenGL 3D graph
-qlw Set the width of leader lines on OpenGL 3D graphs
-qm Set the data label form
-qmi Label points at specified row indices or by space-separated dataset
-qmie Enable or disable show of labels at indices specified by -qmi
-qms Customize the data label display string
-qn Specify the normal vector of the plane for label orientation in 3D graph
-qnx Specify the x component of normal vector of the plane for label orientation in 3D graph
-qny Specify the z component of normal vector of the plane for label orientation in 3D graph
-qnz Specify the z component of normal vector of the plane for label orientation in 3D graph
-qp Set the data label position
-qr Set data label rotation degree
-qs Set data label font size
-qu Set underline for the data label
-qw Set data label whiteout or not
-qx Set data label X offset value
-qy Set data label Y offset value


Other Options

Option Description
-gn Set the LongName of the plot group in which the specified data plot is.
-j Disable the use of substitution notation (% and $) in the argument string
-m Set the specified data plot as movable/not movable with the cursor
-n Rename loose dataset
-pd Show/hide vertical drop lines
-pf Turn the fill area option on or off
-pfv Control the Fill Area Under Curve setting
-pfn Control the mode of Fill to next data plot
-s Show/hide the data plot
-skip Display every nth symbol in a line+symbol data plot
-spf Control the flatten-mode for 3D surface plot
-spz Set the Z offset by percent of the scale range for 3D surface plot
-tb Control the data plot rendering mode
-u Set (update) the current display range for name in the active layer to be true for name in all layers
-ui Update Origin when you type or paste data into an Excel workbook sheet
-w Set connecting line width
-x Associate an X dataset with a Y dataset
-yx Set the dataset to be plot

Example

Example 1

The following script sets the beginning of the display range for col(B) to 10.

range rr = [Book1]Sheet1!B; 
set rr -b 10;

Example 2

The next script sets the line width to 2 pts.

//set the line width of 2nd plot on graph to be 2pts
range rr = !2; 
set rr -w 1000;

Example 3

The next script hides data plot from col(B) in graph.

range rr = [Book1]Sheet1!B; 
set rr -s 0;

Example 4

The following script opens the Plot Details dialog box correspond to active data plot.

set %C;

Example 5

The next script sets the active scatter data plot to display row numbers as data point symbols.

set %C -k 11;

Example 6

The next script adds an XY data plot (col(B) in Book2 sheet1 as Y, col(A) in Book1 sheet1 as X) to the active layer.

range r1 = [Book2]Sheet1!B;
range r2 = [Book1]Sheet1!A;
layer -i r1;
set r2 -x r1;
rescale;

Example 7

In this example, open a new project and import the WIND.DAT file from the Samples\Graphing\ folder. Select the Month column and then move to Last. Set this column as a label column. Select the Power and Month column and select Plot:Scatter. Then run the following script to set the label data plot display attributes.

ii = font(Arial);
//use font function to find Arial index #
range rr = [Wind]Wind!A;
set rr -tr 90;  //rotate 90 degrees
set rr -ty 50;  //50% y offset
set rr -tj 0;  //left justify
set rr -tf ii;  //set as Arial font

Example 8

In this example, we first plot a XY line and then add some other dataset into the graph. Then give each dataset different settings.

newbook; //New a workbook
string wname$ = page.name$; //Get new workbook's name
wks.ncols=10; //Set column numbers to be 10
int nn = wks.ncols;
csetvalue formula:="i-1" col:=1;
Loop(ii, 2, nn)
{
 csetvalue formula:="(i-1)/(2/(ii-1))" col:=$(ii);
}; //Gave every column values
set %c -em 10; //Only display 10 values
plotxy iy:=(1,2) plot:=201; //Plot a scatter graph with first 2 columns
for(jj=3; jj<=nn; jj++)
{
 range rr = [%(wname$)]sheet1!col($(jj));
 string bb$ = %(nameof(rr)$); //change dataset name
 layer -i201 %(bb$); //add new plot to the same layer
}; 
int tt = 3;
repeat 8
{
 int tt2 = 1+mod(tt,3);
 range rr = $(tt-1);
 set rr -c $(tt-1); //set symbol color

 set rr -z $(9+(tt-2)); //set symbol size
 set rr -k $(tt2); //set symbol type
 tt++;
};
rescale;

Example 9

In this example, we first plot a XY scatter, set it to be colormapped and then add some other dataset into the graph. Useing the first plot's setting values to modify the others.

Newbook;
string wname$ = page.name$; // Get workbook name
wks.ncols = 5; // Set number of coiumn to be 5
int nn = wks.ncols;
col(1) = {2000:2010}; // Let the first column be our colormap
Loop(ii, 2, nn)
{
 range rr = [%(wname$)]1!wcol(ii);
 rr = {0:1*(ii-1):10*(ii-1)};
 if(ii>2)
 {
  if(ii==3)
  {
   plotxy iy:=(2,3) plot:=201; // Plot the first scatter using col(3) and col(2)
   set %c -cse $(524389+ii-1); // Set Col(1) be color index
   set %c -cset 2; // Set color pattern to be colormapping
  }
  else {layer -i201 %(nameof(rr)$)}; // Add the rest to the layer
 }
 else
 {
  wks.col$(ii).type = 4; // Set col(2) to be X for plotting
 }; 
};
for(jj=1;jj<4;jj++)
{
 string pp$ = %(wname$)_%(char(jj+66)$);
 switch (jj)
 {
  case 1:
   get %(pp$) -cse t1; 
   get %(pp$) -cset t2;
   get %(pp$) -z t3;
   get %(pp$) -k t4; // Get the first plot's setting values
   break;
  case 2 3:
   set %(pp$) -cse $(t1+jj-1);
   set %(pp$) -cset t2;
   set %(pp$) -z $(jj*t3);
   set %(pp$) -k $(jj+t4-1); // Make some changes and apply to the other 2 plots
   break;
  default:
   break;
 };
};
rescale;

Example 10

Use Increment for symbol color and enable the usage of custom color list:

//Create new workbook, fill data and plot as scatter
newbook;
col(A) = data(1,12);
col(B) = col(A);
plotxy (1,2);
//Use Increment to define symbol color
set %c -csei 1;
//Enable the usage of custom color
set %c -cue 1;
//Define the color indices in the custom color list
set %c -cus 2 4 6 8;

See Also

Get (command)