Common Tasks
Prev
Next

Chapter 2. Common Tasks

This chapter contains instructions for performing basic tasks with Kst. It runs through the method for performing each task in the simplest way. Links to the sections of the handbook with more in-depth information are also given.

Plotting Simple Graphs

The first thing you'll want to do with Kst is probably to plot a simple graph. Here's the procedure:

  1. Choose your data file. Kst will read many types of data file, the simplest being a plain text (ASCII) file with the data in columns. For this tutorial, we'll create a simple data file. Copy and paste this simple 10-line set of data into a text file, and save it as simple.dat:

    x  y
    -5 6.25
    -4 4
    -3 2.25
    -2 1
    -1 0.25
    0 0
    1 0.25
    2 1
    3 2.25
    4 4
    5 6.25
    

    Note

    ASCII is only one of the many file types Kst is capable of reading. For further details on file types, see the Datasources section.

  2. Open Kst. If you are presented with the QuickStart dialog, then click on the Data Wizard button. If the QuickStart dialog does not appear, then you can click the toolbar button to open the Data Wizard. In the wizard that appears, you can enter the pathname of the simple.dat file manually, or select it using the Open File icon openfile-icon which appears next to the path entry textbox. We have put x and y labels on the first line of our data file, so click the Configure... button and set up the data source as shown below.



  3. The Next page is where you select which data to use. If you've configured the ASCII datasource correctly, the field names will have been read from the first entry of the datafile and “x” and “y” will be entries in the Available list on the left-hand side of the page. Move the “y” field to theSelected list using the arrow buttons in the center of the window. The INDEX field is a special field created by Kst; it can be used as X-axis data when the data source does not provide a data vector for the X-axis.

  4. Clicking the Next button again allows you to select Data Presentation options. Under Plot Types, leave the default XY as it is, but change the X Axis Vector to Create From Field: x.

  5. On the Next page, 'Plot Layout', we'll just change one thing: under Curve Style, select Points only to draw just the data points, and not the lines joining them.

  6. Click on Finish and you're done! The new plot appears in the main Kst window.



Tip

It's also possible to quickly create plots from the command line using Kst, similar to Gnuplot. In the case of the simple.dat file, we can produce a simple plot using the first column (or “field”) of the file as the x vector, with the second column as a y vector, by entering the following at the command line:

kst -x 1 -y 2 simple.dat

Numerous other command-line options are available — using the command-line only, plots of data can be printed directly to files, and simple data manipulation such as creation of power spectra can be performed as well. For a complete list of command-line options, see Command Line Usage and Examples.

Prev
Next
Home


Would you like to make a comment or contribute an update to this page?
Send feedback to the KDE Docs Team