Author |
Topic  |
|
Bempel
France
19 Posts |
Posted - 02/22/2003 : 09:58:01 AM
|
Hi, I have one more problem with my script; I want to plot a column (G) in a second graph (layer 2) on the same template. I want to keep layer 1 unchanged. So the graph's name, the temperature Tc and the efficient temperature Teff still have to be on the same position (top right of the first graph layer1). The problem is now to change the script in the way that it puts 4 plots on a first graph (layer1) and a fifth plot on a second graph (layer2).
The x-axis (Column A) is the same for both graphs. Here is the script:
[Main] getfilename *.dat; getnumber "rayonne" r; getnumber "first graph to be plotted" ini; getnumber "last graph to be plotted" nbc; // next command sets the range for mean calculation getnumber (start) rr1 (stop) rr2 (Enter range used to find the mean...); // now specify the starting temperature getnumber ( ) temp (Enter initial temperature...); //tt=temp; // may want to use same temperature next time, so work with a new variable
loop (ii,ini,nbc) { type $(ii); %O=%[%a,'_']_$(ii).dat; win -t wks; open -w %O; type %O; type %H; work -c M; work -c N; work -c O;
%H_M=abs(%H_H); %H_N=%H_H+r; %H_O=abs(%H_I); // find mean of col(L) set col(L) -bs rr1; set col(L) -es rr2; sum(col(L)); run.section(,MakePlot); // create plot, add datasets to layer, etc.
label -s -p 103 0 \+(%H); // labels the graphs name on given position %L="T\-(c) = $(temp) C"; // create string for temperature %M="T\-(eff) = $(sum.mean) C"; // create string for column mean // %L=%L //%M; // combine %L and %M as single 2-line string label -s -p 103 5 \+(%L); label -s -p 103 10 \+(%M);
// tt++; // increment temperature for next graph temp=temp-2 };
[MakePlot] %J=%H; win -t plot rheo2 G%[%O,'.']; layer1.include(%J_O,201); //I'VE ADDED 1 layer1.include(%J_M,201); //I'VE ADDED 1 layer1.include(%J_N,201); //I'VE ADDED 1 layer1.include(%J_I,201); //I'VE ADDED 1
set %J_I -k 2; // shape#=1 (square), 2 (circle), ... set %J_I -cse 1; set %J_I -csf 18; set %J_I -z 8;
set %J_M -k 1; // shape#=1 (square), 2 (circle), ... set %J_M -csf 1; // fill color#=1 (black), 2 (red), 3 (green), etc set %J_M -cse 1; // edge color set %J_M -z 8; // set symbol interior 2=open
set %J_N -k 5; set %J_N -csf 2; set %J_N -cse 2; set %J_N -z 8;
set %J_O -k 1; set %J_O -cse 1; set %J_O -csf 18; set %J_O -z 10;
layer1 -b c 1; //I'VE ADDED 1 X1=0.01; X2=1000; // x-axis range Y1=100; Y2=10000000; // y-axis range
layer2.include(%J_G,201); //ADDED THIS LINE
layer2 -b c 1; //ADDED THIS LINE X1=0.01; X2=1000; // x-axis range ADDED THIS LINE Y1=0; Y2=40; // y-axis range ADDED THIS LINE
set %J_G -k 2; //ADDED THIS LINE set %J_G -cse 1; //ADDED THIS LINE set %J_G -csf 18; //ADDED THIS LINE set %J_G -z 8; //ADDED THIS LINE
[Collect] // specify cell by column and row number getnumber (column) cc (row) rr (Enter column and row numbers...); tmp2={0}; // create a temporary dataset with one element nn=0; // doc -e W { } loops through all worksheets in the project and performs the operation inside { } // on each. Worksheet is identified by %H each time. doc -e W { tmp2=%(%H,cc,rr); // replace value in tmp2 with desired cell value if(nn==0) tmp1=tmp2; // first time we duplicate tmp2 as tmp1 else copy -a tmp2 tmp1; // later we append tmp2 to tmp1 nn++; // keep track of number of worksheets }; win -t wks; // create new worksheet set %H -er nn; // give it the correct number of rows col(1)=tmp1; // copy tmp1 to col(1) del tmp1; del tmp2; // delete temporary datasets
I hope someone can help me on this and I really appreciate your help
Thanks
Stephane |
|
Mike Buess
USA
3037 Posts |
Posted - 02/22/2003 : 1:38:21 PM
|
Hi Stephane,
The layer command acts on the active layer. You cannot append the layer number to the command name like you can with the layer object. In other words, the following are not legal LabTalk commmands and will generate command errors that stop script execution...
layer1 -b c 1; layer2 -b c 1;
The proper usage is
page.active=1; // activate layer 1 layer -b c 1; page.active=2; // activate layer 2 layer -b c 1;
The layer object also assumes the active layer unless you append a layer number. So your MakePlot script should look more like this...
[MakePlot] %J=%H; win -t plot rheo2 G%[%O,'.'];
page.active=1; // activate layer 1
layer.include(%J_O,201); layer.include(%J_M,201); layer.include(%J_N,201); layer.include(%J_I,201);
set %J_I -k 2; // shape#=1 (square), 2 (circle), ... set %J_I -cse 1; set %J_I -csf 18; set %J_I -z 8;
set %J_M -k 1; // shape#=1 (square), 2 (circle), ... set %J_M -csf 1; // fill color#=1 (black), 2 (red), 3 (green), etc set %J_M -cse 1; // edge color set %J_M -z 8; // set symbol interior 2=open
set %J_N -k 5; set %J_N -csf 2; set %J_N -cse 2; set %J_N -z 8;
set %J_O -k 1; set %J_O -cse 1; set %J_O -csf 18; set %J_O -z 10;
layer -b c 1; X1=0.01; X2=1000; // x-axis range Y1=100; Y2=10000000; // y-axis range
page.active=2; // activate layer 2
layer.include(%J_G,201); //ADDED THIS LINE
layer -b c 1; X1=0.01; X2=1000; // x-axis range ADDED THIS LINE Y1=0; Y2=40; // y-axis range ADDED THIS LINE
set %J_G -k 2; //ADDED THIS LINE set %J_G -cse 1; //ADDED THIS LINE set %J_G -csf 18; //ADDED THIS LINE set %J_G -z 8; //ADDED THIS LINE
Hope that helps.
Mike Buess Origin WebRing Member |
 |
|
|
Topic  |
|
|
|