Author |
Topic  |
|
Bempel
France
19 Posts |
Posted - 11/18/2002 : 5:32:02 PM
|
I have to plot 30 graphs every day, and I do this by opening a saved graph, importing the new Ascii file, and saving the project under a different name. Now, looking for a method to automate this, I found the following script:
getfilename *.dat; getnumber "nb de courbe" nbc; ii=1; loop (ii,1,nbc){ type $(ii); %O=%[%a,'_']_$(ii).dat; win -n wks; open -w %O; type %O; type %H; %H_H=abs(%H_H); %H_I=abs(%H_I); %J=%H; win -t plot rheo G%[%o,'.']; layer.include(%J_H,201); layer.include(%J_I,201); layer -all ask; };
This script works, but it isn’t perfect. It imports a defined number of ascii files and plots my columns H and I, using the template rheo. Now the problems:
1) It (=the script) uses the number of lines of column H and I as default x-axis. But I want the x-axis to be column A. 2) On the graphs, I want the X and the Y-axis to be fixed. Or in the axis scale-tab, I only find 5 different Rescale Drop-down Lists : manual, normal, auto, fixed from and fixed to. I want the lower and the upper limit to be fixed, but there isn’t such a feature (i.e. fixed from-to). When I put it to manual, a popup window appears at every graph telling me that x-scale is in manual mode, and asking me if I want to override it for rescaling. So I have to answer no for every graph… 3) I also want the name of the graph added to the graph as a layer. What is the command to do this?
I am a beginner with labtalk, but I'm trying to work on it… Thanks for helping me
Stephane
|
|
Mike Buess
USA
3037 Posts |
Posted - 11/18/2002 : 7:27:32 PM
|
Hi Stephane,
1) The "win -n wks" command opens a blank worksheet and all imported columns are Y columns by default. There are two solutions.
1a> Change the first column to an X column like this... open -w %O; // creates your 3 columns worksheet -t 1 4; // makes the first column (A) an X column
1b> Alternatively, use "win -t wks" instead of "win -n wks". win -t creates a worksheet from the default worksheet template in which the first column is already an X column.
2) You can set and get the lower and upper X axis limits with the variables X1 and X2, respectively. Similarly, Y1 and Y2 are the Y axis limits. To fix both axes, replace the last line of your script (layer -all ask) with this...
X1=0; X2=10; // or whatever you want for the X axis limits Y1=0; Y2=100; // similarly for the Y axis
3) I assume you mean that you want to add the name of the graph as a text label, rather than layer. Conclude the script within your loop with the following command...
label -s -a x y %H;
where x and y are the desired coordinates (position) of the text label.
I hope that helps.
Mike Buess Origin WebRing Member |
 |
|
Bempel
France
19 Posts |
Posted - 11/19/2002 : 05:22:50 AM
|
Hi Mike Buess, thank you for helping me on this. All responses work fine, but I am not quite satisfied with the position of the text label.With the command: label -s -a x y %H; the label is placed on the graph. I would like to see the label next to the graph on the right side, on the template.
Furthermore and want to know which command to use to print these graphs once tey are created.
Thanks
Stephane
Edited by - Bempel on 11/19/2002 05:24:13 AM |
 |
|
Mike Buess
USA
3037 Posts |
Posted - 11/19/2002 : 09:39:07 AM
|
Hi Stephane,
quote: I would like to see the label next to the graph on the right side, on the template.
x in the label command can be greater than X2 (the right X axis limit).quote: Furthermore and want to know which command to use to print these graphs once tey are created.
print; // print the active window
In answer to your email question...quote: how can I determine what form my layer will have (circle, or not, filled color or not,...) ?
Use the "set" command to change the plot properties of a dataset...
set %J_C -k shape#; // shape#=1 (square), 2 (circle), ... (same order as in plot properties drop-down list) set %J_C -csf color#; // fill color#=1 (black), 2 (red), 3 (green), etc
There are many more plot properties that can be changed with the set command. Refer to your LabTalk programming guide for details.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 11/19/2002 09:47:42 AM |
 |
|
|
Topic  |
|
|
|