Author |
Topic |
|
Selinger78
Germany
Posts |
Posted - 10/19/2005 : 07:40:17 AM
|
Origin Version (Select Help-->About Origin): Operating System: Win2K
Hello, following problem. I import an ASCII File via a script, then I want the script to select certain columns an plot them into a template. When I do it without scrip - just by selecting columns and go to plot->template it works fine, I get the graph I want to with different colors (as originally saved in the template). When I use the following script, I get the same result, but all graphs are black:
[main]
getfile *.dat; open -w %A;};
wks.col1.Width=15; wks.col2.Width=15; wks.col3.Width=15; wks.col4.Width=15; wks.col5.Width=15; wks.col6.Width=15;
wks.col1.name$="time"; wks.col2.name$="temperature"; wks.col3.name$="diode1"; wks.col4.name$="diode2"; wks.col5.name$="diode3"; wks.col6.name$="diode4";
worksheet -s 1; worksheet -s 3; worksheet -s 4; worksheet -s 5; worksheet -s 6;
win -t P "diodeplot.OTP" full range lay -i %W_time; lay -i %W_diode1; lay -i %W_diode2; lay -i %W_diode3; lay -i %W_diode4;
// So if anybody knows what to add the lay command or to the execution command of the template to get different colored lines in my graph, please tell me. Thanks, Selinger 78
|
|
Mike Buess
USA
3037 Posts |
Posted - 10/19/2005 : 07:55:05 AM
|
Use the set command with -c option...
set %W_diode1 -c 2; // red set %W_diode2 -c 3; // green set %W_diode3 -c 4; // blue
Mike Buess Origin WebRing Member |
|
|
Selinger78
Germany
Posts |
Posted - 10/19/2005 : 08:40:29 AM
|
Perfect! Now it works! Is there also a trick how to change the legend entries? Now the legend says
diode1 diode2 ...
Can I (by scripting) change these entries to e.g.
beam 1 after prism beam 2 after prism ... ?
Thanks a lot for your help! Selinger78
|
|
|
Mike Buess
USA
3037 Posts |
Posted - 10/19/2005 : 08:59:53 AM
|
Add the desired legend text to the labels of the corresponding columns. Then return to graph and click the Refresh button.
Mike Buess Origin WebRing Member |
|
|
Selinger78
Germany
Posts |
Posted - 10/19/2005 : 11:04:51 AM
|
Hello, Sorry, but which labels? How can I set such a label by script language? Regards, Selinger78
|
|
|
Mike Buess
USA
3037 Posts |
Posted - 10/19/2005 : 12:33:04 PM
|
The legend uses the column label by default. If label is missing it defaults to column name, which I suppose is what you're seeing. You can create the labels by expanding your script at the top ...
wks.col3.name$="diode1"; wks.col4.name$="diode2"; wks.col5.name$="diode3"; wks.col6.name$="diode4"; wks.col3.label$="beam 1 after prism"; wks.col4.label$="beam 2 after prism"; // etc.
Mike Buess Origin WebRing Member |
|
|
Selinger78
Germany
Posts |
Posted - 10/20/2005 : 06:36:03 AM
|
Thanks a lot! This works now, but I noticed another strange output for my graph. When using the script as written in my first post (with additions from the replys) it produces overlayed axis, the one from my template and additional one x and one y-axis with with values from 1 to 10. How can I supress these additional axis?
And is there a script option to export graphs automatically with the name of the ascii-file which was opened?
|
|
|
Mike Buess
USA
3037 Posts |
Posted - 10/20/2005 : 07:15:05 AM
|
Sounds like you've added a new layer but I don't see those commands in the script at the top. Anyway, use layerN.showx and layerN.showy hide x and y axes in layer N.quote: And is there a script option to export graphs automatically with the name of the ascii-file which was opened?
Use image.export or export.image to export a window to a graphics file. You must supply the file name yourself.
Mike Buess Origin WebRing Member |
|
|
Selinger78
Germany
Posts |
Posted - 10/20/2005 : 09:08:04 AM
|
You are right! There was a copy-paste artefakt from another script hiding in the sript! Sory for all the newbie-questions, I am already working with the labtalk help file but I just can't get certain things - unless I ask here. Thanks for your help! Will try the export-function now! Selinger78
|
|
|
|
Topic |
|