[Kst] ASCII data - confusion about multiple plots

Barth Netterfield netterfield at astro.utoronto.ca
Thu Feb 4 00:06:45 UTC 2016


Hmmm...  What version of kst are you using?  what platform?

I am on Linux.

For a reasonably recent version of kst2:

If I have files d1.dat, d2.dat, and d3.dat.  Each are 2 column data,
delimited to whatever you have set the default to in the gui.  (by default,
this is space).

     $ kst2 -P 1 d1.dat -x 1 -y 2 d2.dat -x 1 -y 2 d3.dat -x 1 -y 2

will put all three curves in the same plot

Whe I try kst2 --help, I get:

$ kst2 --help
KST Command Line Usage
************************
*** Load a kst file: ***
kst [OPTIONS] kstfile

[OPTIONS] will override the datasource parameters for all data sources in
the kst file:
     -F  <datasource>
     -f  <startframe>
     -n  <numframes>
     -s  <frames per sample>
     -a                     (apply averaging filter: requires -s)

************************
*** Read a data file ***
kst datasource OPTIONS [datasource OPTIONS []]

OPTIONS are read and interpreted in order. Except for data object options,
all are applied to all future data objects, unless later overridden.
Output Options:
     --print <filename>       Print to file and exit.
     --landscape              Print in landscape mode.
     --portrait               Print in portrait mode.
     --Letter                 Print to Letter sized paper.
     --A4                     Print to A4 sized paper.
     --png <filename>         Render to a png image, and exit.
File Options:
     -f <startframe>          default: 'end' counts from end.
     -n <numframes>           default: 'end' reads to end of file
     -s <frames per sample>   default: 0 (read every sample)
     -a                       apply averaging filter: requires -s

Ascii File Options - for ascii files only: these are all stick
     --asciiDataStart <Line>  Data starts here. Files start at line 1.
     --asciiFieldNames <Line> Field names are in this row.
     --asciiNoFieldNames      Fields are named for their data column
     --asciiReadUnits <Line>  Read units from line <Line>
     --asciiNoUnits       Do not read units
     --asciiSpaceDelim        Columns are Space/tab delimited
     --asciiDelim <char>      Columns are dlimited with <char>
     --asciiFixedWidth <w>    Columns have width <w>
     --asciiNoFixedWidth      Columns are delimited, not fixed width
     --asciiDecimalDot        Use a . as a decimal separator (ie, 10.1)
     --asciiDecimalComma      Use a , as a decimal separator (ie, 10,1)
Position:
     -P <plot name>:          Place curves in one plot.
     -A                       Place future curves in individual plots.
     -m <columns>             Layout plots in columns
     -T <tab name>            Place future curves a new tab.
Appearance
     -d:                      use points for the next curve
     -l:                      use lines for the next curve
     -b:                      use bargraph for the next curve
     --xlabel <X Label>       Set X label of all future plots.
     --ylabel <Y Label>       Set Y label of all future plots.
     --xlabelauto             AutoSet X label of all future plots.
     --ylabelauto             AutoSet Y label of all future plots.
Data Object Modifiers
     -x <field>:              Create vector and use as X vector for curves.
     -e <field>:              Create vector and use as Y-error vector for
next -y.
     -r <rate>:               sample rate (spectra & spectograms).
Data Objects:
     -y <field>               plot an XY curve of field.
     -p <field>               plot the spectrum of field.
     -h <field>               plot a histogram of field.
     -z <field>               plot an image of matrix field.

****************
*** Examples ***

Data sources and fields:
Plot all data in column 2 from data.dat.
      kst data.dat -y 2

Same as above, except only read 20 lines, starting at line 10.
      kst data.dat -f 10 -n 20 -y 2

... also read col 1. One plot per curve.
      kst data.dat -f 10 -n 20 -y 1 -y 2

Read col 1 from data2.dat and col 1 from data.dat
      kst data.dat -f 10 -n 20 -y 2 data2.dat -y 1

Same as above, except read 40 lines starting at 30 in data2.dat
      kst data.dat -f 10 -n 20 -y 2 data2.dat -f 30 -n 40 -y 1

Specify the X vector and error bars:
Plot x = col 1 and Y = col 2 and error flags = col 3 from data.dat
      kst data.dat -x 1 -e 3 -y 2

Get the X vector from data1.dat, and the Y vector from data2.dat.
      kst data1.dat -x 1 data2.dat -y 1

Placement:
Plot column 2 and column 3 in plot P1 and column 4 in plot P2
      kst data.dat -P P1 -y 2 -y 3 -P P2 -y 4



On Wed, Feb 3, 2016 at 6:59 PM, Daniel Miller <dmiller at vitalconnect.com>
wrote:

> I would appreciate the command-line args to handle plotting multiple
> files; the --help argument only documents 5 arguments, and doesn't even
> work the way it is documented... I found a more complete command-line help
> in the Kst Handbook, but task like these aren't all that obvious...
>
>
> On Wed, Feb 3, 2016 at 3:52 PM, Barth Netterfield <
> netterfield at astro.utoronto.ca> wrote:
>
>> Yes:
>> the last page of the data wizard gives an option to put the curve in a
>> plot that already exists.
>> The curve creation dialog has an option to put the curve in a plot that
>> already exists.
>> You can do it from the command line even easier.  I can give you the
>> incantation if you can't clean it from kst2 --help.
>>
>> cbn
>>
>>
>>
>>
>>
>> On Wed, Feb 3, 2016 at 6:36 PM, Daniel Miller <dmiller at vitalconnect.com>
>> wrote:
>>
>>> hmmm... well, I prefer lines to points in kst2; the plots with points
>>> are sort of hard to utilize, but I'll take a look at it and see what it
>>> looks like.
>>>
>>> Alternately, is there some way to input three data files, but have them
>>> plotted on one plot??  I haven't really seen that in the manual either...
>>>
>>>
>>> On Wed, Feb 3, 2016 at 3:33 PM, Barth Netterfield <
>>> netterfield at astro.utoronto.ca> wrote:
>>>
>>>> As you have sort of figured out, kst's data source model will want you
>>>> to have 3 different ascii files in this case.
>>>>
>>>> But, if you just want to plot points, and not lines, you can use NaN as
>>>> your bad data marker.
>>>>
>>>> On Wed, Feb 3, 2016 at 6:30 PM, Daniel Miller <dmiller at vitalconnect.com
>>>> > wrote:
>>>>
>>>>> I have kst2 working with single plot stream... that works very
>>>>> nicely.  At this point, I'm using space as separator between fields.
>>>>>
>>>>> However, we have a couple of data streams which contain multiple data
>>>>> (x, y, z); in this situation, what our data would look like is ( timestamp,
>>>>> data), but the data would be one of { data_x, data_y, data_z }.  In other
>>>>> words, the data stream that I receive from the hardware, delivers data_x,
>>>>> data_y, data_z in separate messages, with different timestamps.
>>>>>
>>>>> I want kst2 to read this ascii data file and plot 3 separate graphs on
>>>>> one plot.
>>>>> I'm a little confused about how to do this, though;
>>>>>
>>>>> for example, say I have a line with data for data_z; this will look
>>>>> something like:
>>>>> timestamp data_z
>>>>> however, I want one file to contain data for all three streams, so I'm
>>>>> guessing I need to have empty fields for the not-relevant data; maybe
>>>>> something like:
>>>>> timestamp unused_x unused_y data_z
>>>>> timestamp unused_x data_y unused_z
>>>>> etc...
>>>>>
>>>>> So first off, I probably have to use a different separator rather than
>>>>> space for separator; but even with comma, I still have a problem; for
>>>>> example:
>>>>>
>>>>> timestamp, 0, 0, data_z
>>>>> timestamp, 0, data_y, 0
>>>>>
>>>>> Except that in some cases, 0 is valid data; I *think* I need some way
>>>>> to represent "invalid data" in the unused fields.
>>>>>
>>>>> Is this understandable??  How do I handle this??
>>>>> Dan Miller
>>>>>
>>>>> _______________________________________________
>>>>> Kst mailing list
>>>>> Kst at kde.org
>>>>> https://mail.kde.org/mailman/listinfo/kst
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> C. Barth Netterfield
>>>> University of Toronto
>>>> 416-845-0946
>>>>
>>>>
>>>> _______________________________________________
>>>> Kst mailing list
>>>> Kst at kde.org
>>>> https://mail.kde.org/mailman/listinfo/kst
>>>>
>>>>
>>>
>>> _______________________________________________
>>> Kst mailing list
>>> Kst at kde.org
>>> https://mail.kde.org/mailman/listinfo/kst
>>>
>>>
>>
>>
>> --
>> C. Barth Netterfield
>> University of Toronto
>> 416-845-0946
>>
>>
>> _______________________________________________
>> Kst mailing list
>> Kst at kde.org
>> https://mail.kde.org/mailman/listinfo/kst
>>
>>
>
> _______________________________________________
> Kst mailing list
> Kst at kde.org
> https://mail.kde.org/mailman/listinfo/kst
>
>


-- 
C. Barth Netterfield
University of Toronto
416-845-0946
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kst/attachments/20160203/cf3b39dd/attachment.html>


More information about the Kst mailing list