[Kst] kst scripting beginner...

Brisset, Nicolas Nicolas.Brisset at eurocopter.com
Tue Jun 15 08:34:25 CEST 2010


Hi Jacques,

> I am having a hard time finding a good kst scripting documentation...
> (besides the rather dry list of methods in the user manual).
I myself have never been a heavy user of scripting until now (using kst
1.x on Solaris where it crashes with SIGALARM!), so I can't really help
you there. But read on for a possible alternative...
 
> I am trying to display a bunch of experimental data together:
> kst -y 1 -y 2 -y 3 -y 4 -y 5 -y 6 -y 7 -y 8 -y 9 -y 10 -y 11  /tmp/p
> 
> # I found this example somewhere to label the x axis:
> kstcmd
> > var p0 = Kst.windows[0].plots[0];
> > p0.xAxis.label = "Time";
> 
> If works fine, but I would like to label each of my plots (say -y1 is
> "300 [Kelvin]"), move the labels outside the plotting area, add a
> general title maybe.
> 
> How do I do this? Is there an easy kscript tutorial somewhere.
> Note: I am using gnome and I do not have the java console working.
Here is how I work when I want to plot the same data through different
experiments: 
- use the data wizard to load the data I'm interested in, it creates
nice plots with titles, named axes, etc. And in kst 2.x soon even units
(depending on the file type)...
- fine-tune everything I want using the GUI
- save the plot (say template.kst)
- use the -F command-line switch to override the data file with a
different one (e.g. if the 1st experiment was in exp1.dat, then I'd load
"kst -F exp2.dat template.kst" to plot the same data for the second
case)
That works very well if you have only one data file (there is only one
-F switch...). An alternative may be to use the "Change data file" tool
(Tools menu -> Change data file...), but then you have to do it
interactively.
Another alternative is to use some command line unix tools (sed) to
replace the datafile names in the .kst prior to loading. The .kst is XML
(hence ASCII) and pretty straightforward, so it's not too bad.
 
> I am generating many plots automatically (with different data) and I
do
> not want to have to use the GUI every time.
Sure. You can even use the --print option to print directly to a file
and generate reports while you go for a coffee :-)

Hope this helps,

Nicolas 


Eurocopter Deutschland GmbH
Sitz der Gesellschaft/Registered Office: Donauwoerth
Registergericht/Registration Court: Amtsgericht Augsburg HRB 16508
Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: Dr. Lutz Bertling
Geschaeftsfuehrung/Board of Management:
Dr. Wolfgang Schoder, Vorsitzender/CEO; Friedrich-Wilhelm Hormel; Ralf Barnscheidt

CONFIDENTIALITY NOTICE 

This communication and the information it contains is intended for the addressee(s) named above and for no other persons or organizations. It is confidential and may be legally privileged and protected by law. The unauthorized use, copying or disclosure of this communication or any part of it is prohibited and may be unlawful. 
If you have received this communication in error, kindly notify us by return e-mail and discard and/or delete the communication. Thank you very much. 
It is possible for e-mails to be intercepted or affected by viruses. Whilst we maintain virus checks on our e-mails, we accept no liability for viruses or other material which might be introduced with this message. 



More information about the Kst mailing list