Create plot from XY data by specifying plot type and properties
Minimum Origin Version Required: Origin 8 SR0, updated in Origin 8.5.1 SR0. The option to hide the created graph is available starting with 9.0.
1. plotxy iy:=(1,2); 2. plotxy iy:=(1,2,3); // Plot col(2) with col(3) as error bar 3. plotxy iy:=[Book1]2!(1,3) o:=[Graph1]1!; 4. plotxy (?,1:end); 5. plotxy [Book1]2!(#, 3); 6. plotxy (1:3)!(1,2) plot:=200; // Plot col(2) of the 1~3 sheet in the active workbook. 7. plotxy ((1,2[1:6]),(1,2[7:12]),(1,2[13:18])) plot:=202 ogl:=[<new template:=doubley name:=SamplePlot>]; // Plot 3 ranges of col(2) into a specified graph template and name the graph as SamplePlot. 8. plotxy (1,3) ogl:=2; // Plot the col(3) into layer 2. 9. plotxy (1,2) plot:=186 ogl:=<new template:=PolarXrYTheta>; // Polar r(X) theta(Y) 10. plotxy (1,2) plot:=192 ogl:=<new template:=Polar>; // Polar theta(X) r(Y) 11. plotxy iy:=[Book2]"Sheet1"!(Col(1),Col(5)[60]:Col(8)[80]) plot:=200 ogl:=[Graph11]1!; //showing how to plot data from column 5, row 60 to column 8, row 80
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
Input | iy |
Input XYRange |
|
Specifies the input data, including X column, Y column, Y error column. |
Plot Type | plot |
Input int |
|
Specifies the plot type. The most common are 200, line; 201, scatter; 202, line + symbol. For the list of all plot types, see Plot Type IDs. Note: only the plot types for XY range can be used. |
Symbol Size (Pts) | size |
Input double |
|
Specifies the symbol size in points. Here the default value is -1, which means that the size will always follow the symbol size specified in the template automatically. |
Rescale | rescale |
Input int |
|
Specifies whether to rescale the graph (1) or not (0). |
Legend | legend |
Input int |
|
Specifies whether to generate the legend on graph. |
Plot Color | color |
Input int |
|
Specifies the color of plots. This only works on Line, Symbol and Line+Symbol graphs. Color may be an index into Origin's Color List : 1 (Black), 2 (Red), up to 24 (Dark Gray) or up to 40 if you have defined the 16 Custom Colors in the Color dialog. Additionally, you can use the color function to assign any RGB color, as in |
Hide Newly Created Graph | hide |
Input int |
Specify whether to hide the newly created graph (1) or not (0). | |
Layer to Plot into | ogl |
Output GraphLayer |
|
Specifies the graph layer to add plots. Use range syntax. |
This function plots data from specified range, which can include Y error column. You can specify the plot type and symbol size. You can also specify whether to show the legend and whether to rescale the graph.
plotxy (?, 5); // if col(5) happens to be X column call fails plotxy (#, 3); // plot col(3) as Y and use row number as X
plotxy iy:=(1, 2, 3); // plot col(2) vs col(1), with col(3) as Y error
// plot polar graph plotxy (1,2) plot:=186 ogl:=<new template:=PolarXrYTheta>; // Polar r(X) theta(Y) plotxy (1,2) plot:=192 ogl:=<new template:=Polar>; // Polar theta(X) r(Y)
newbook; string fn$ = System.path.program$ + "Samples\Curve Fitting\Exponential Decay.dat"; impasc fn$; string bn$ = %H; int nCols = wks.ncols; win -t Plot; // Create an empty plot loop (ii, 2, nCols) { // Add dataset into a layer plotxy [bn$]1!$(ii) plot:=201 rescale:=1 color:=ii ogl:=!1; } // Group the curves layer -g;
// plot waterfall graph plotxy iy:=(1,2:4) plot:=210 ogl:=<new template:=glWater3D>; //Y color mapping plotxy iy:=(1,2:4) plot:=210 ogl:=<new template:=glWater3D>; set %C -LGCB 0; //Z color mapping plotxy iy:=(1,2:4) plot:=210 ogl:=<new template:=glWater3D>; set %C -LGCB 3;
// Start with a new Book newbook; col(1) = data(1,30); col(2) = normal(30); col(3) = uniform(30); // Auto-creation of column 3 // Remember Book and Sheet names string bkname$ = page.name$; string shname$ = layer.name$; // Since sheet is active, we can specify column range plotxy (1,2:3); // Remember ranges within our Book and Sheet range r1 = [bkname$]shname$!3[1:15]; range r2 = [bkname$]shname$!3[16:end]; // Now that graph is active window, need to specify Book and Sheet plotxy [bkname$]shname$!((2[1:15]),(2[16:30])); // Creates second layer // or use range which knows its Book and Sheet plotxy iy:=r1 ogl:=2; plotxy iy:=r2 ogl:=2; page.active = 2; color = 1; doc -e DY { set %C -c $(color); color++; } layarrange row:=2 col:=1 ygap:=7 left:=12 right:=12 top:=10 bottom:=15; legendupdate update:=0 legend:=0 mode:=1;