| T O P I C R E V I E W |
| Rene_AC |
Posted - 09/19/2019 : 07:39:30 AM Origin Ver. and Service Release: OriginPro 2018G (64bit) Operating System: Windows 10
Hey guys,
i'll need to do several graphs, all with the exact same layout, all with the exact same amount of Data in it.
Here is the situation: I have 4 Sheets in my Book, where Sheet 1 is the experimental Data, and Sheet 2, 3 and 4 are simulated Data. The layout of the Sheets is all the same (so A(X) is the Temperature, and B to ... Y are the measured quantities, and for each sheet, the quantity in each column is the exact same kind, e.g. on each sheet in column B i have the amount of CO2 measured/simulated)
Now I want to plot a graph for each measured quantity with the experimental data, and the 3 simulated ones. (So one graph for Temperature VS column B of all 4 Sheets, next graph for Temp vs. column C, and so on...
There must be a quick batch way to do this? If so, could you help me find it? :D
Best,
Rene
|
| 6 L A T E S T R E P L I E S (Newest First) |
| Echo_Chu |
Posted - 09/22/2019 : 10:35:45 PM Hi,
As your columns are in different sheet, you can use code as below to add plots to your user-defined template. In the example my template is mylines.otpu.
int ncol = wks.nCols;
for ( int ii = 2; ii <= ncol; ii++)
{
plotxy iy:=[book1]1!(1,wcol(ii)) plot:=200 ogl:=[<new template:=mylines.otpu>]; //create new graph from 1st sheet.
plotxy iy:=[book1](2:4)!(1,wcol(ii)) plot:=201 ogl:=1; //add plot to graph with data in 2nd - 4th sheet.
}
One thing should be noted that the plots from sheet 2-4 added to graph by codes above are grouped by default. So the prepared template should also have 2~4 plots grouped. Otherwise the color may be not the same as you expected.
Echo OriginLab Technical Support
quote: Originally posted by Rene_AC
Ah i see, i understand whats happening there.
But i think my question was wrong.
I have a user defined template, lets call it PyroTemp, for this kind of data, and i would like that all plots will be created with this particular template.
I have tried
int ncol = wks.nCols; for ( int ii = 2; ii <= ncol; ii++) { plotxy [Book1](1:end)!(1,$(ii)) ogl:=[<new template:=PyroTemp name:=test>]; }
But this does not seem to do the trick.
Could you help me out one more time?
|
| YimingChen |
Posted - 09/20/2019 : 08:47:18 AM Hi Rene,
Since you are plotting different columns cross multiple worksheets, the graph template just can't pick right columns. My suggestion is too plot all the graphs first, then customize one of them, then copy format and apply format to all other graphs.
Thanks James |
| Rene_AC |
Posted - 09/20/2019 : 03:17:56 AM Ah i see, i understand whats happening there.
But i think my question was wrong.
I have a user defined template, lets call it PyroTemp, for this kind of data, and i would like that all plots will be created with this particular template.
I have tried
int ncol = wks.nCols; for ( int ii = 2; ii <= ncol; ii++) { plotxy [Book1](1:end)!(1,$(ii)) ogl:=[<new template:=PyroTemp name:=test>]; }
But this does not seem to do the trick.
Could you help me out one more time? |
| YimingChen |
Posted - 09/19/2019 : 2:31:14 PM Hi Rene,
Please try the script below instead.
int ncol = wks.nCols;
for ( int ii = 2; ii <= ncol; ii++)
{
plotxy [Book1]1!(1,$(ii)) ogl:=[<new>]<new> plot:=200;
plotxy [Book1](2:end)!(1,$(ii)) plot:=201 ogl:=<active>;
}
Thanks James |
| Rene_AC |
Posted - 09/19/2019 : 11:32:36 AM Perfect, thank you very very much. This is exactly what i was looking for.
Just one more question:
Can i define a certain graph template for the data to be plotted ? (Experiments as dots, Simulation as lines, colors etc.)
|
| YimingChen |
Posted - 09/19/2019 : 09:18:09 AM Hi Rene,
It would be easy to do this batch plotting with simple Labtalk script. Please activate the first worksheet. Go to menu Window->Script Window. Copy/Paste following script, highlight all and press Enter to execute.
int ncol = wks.nCols;
for ( int ii = 2; ii <= ncol; ii++)
{
plotxy [Book1](1:end)!(1,$(ii)) ogl:=[<new>]<new> plot:=200;
}
You may need to change the [Book1] in the script to your own workbook name. What this script do is that in each iteration it plots the i'th column of all worksheets into one graph.
James
|
|
|