KMatplot imports data files in two formats:
- binary Matlab MAT 1.0 files, - plain ASCII files
Notice:
Octave can save or load data in both formats.
Example of ASCII file with two matrices:
# Created Wed Feb 9 11:46:23 2000 # name: first 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 # Wed Feb 9 10:41:28 2000 # name: second 2.5 2.44581724 2.28914051 2.04694816 1.74548549 1.41742065 1.09830458 0.822718428 0.620526249 0.513638697 0.513638697 0.620526249 0.822718428 1.09830458 1.41742065 1.74548549 2.04694816 2.28914051 2.44581724 2.46762566 2.41414455 2.25949674 2.02044072 1.72288191 1.39906543 1.08408182 0.812064441 0.612490597 0.50698721
This is a common, space separated, ASCII file with a one matrix row per single line. Lines starting with '#' are ignored, but the ones, which start with '# name:' can be used as a matrix name and will be shown in the 'Import Data' dialog. Single file can contain many matrices separated by comments ( so you cannot put comments beetwen two rows of the same matrix ).
To import ASCII or MAT data into KMatplot choose 'File/Import Data' from the main menu. When you choose an input file, the list of available matrices should appear in the right listbox. From now on you can import data by assigning a given matrix to the selected channel. Just select the destination channel on the left list and next assign a matrix to it by highlighting its name on the right list. This setting will be remembered, so you can select the next channel and the next matrix and the next channel once again ... There is always shown a short hint for each channel, when you select it, so there is no detailed description of them in this document.
Select 'File/Export data' from the main menu. Next choose a file name and mark channels to export. You can write multiple matrices to one file at one time. Press 'Create file' button. That's all !
Only ASCII files are supported in the current version of KMatplot.
Just choose File/Print from the main menu.
You can change printing resolution - default value is 72 dpi ( points per inch ) - by choosing File/Print DPI from the main menu. This affect mostly the printing quality:
- coordinates are calculated with increased accuracy,
- bitmaps are generated with better resolution ( pixmap and OpenGL modes )
- lines are thinner, patterns are more dense.
Plots made with OpenGL are drawn on a bitmap, next this bitmap is printed to the Postscript output. You can change resolution of the generated bitmap as explained above. For highest quality it should be the same as the resolution of your printer, but this always results in large output files.
Easy and fast way to set new ranges on axes.Additional functions:
Zoom Out - right button click
Autoscale - double click
Locates a datapoint at the click position and shows its parameters, coordinates and position in the data matrix. It locates also points on 3-D plots, but unfortunately those invisible ones too. So use it with care !
Allows moving and resizing objects on the canvas. When selected object is clicked again the rotation mode is turned on and handles became a small squares. Currently only labels and arrows allows rotating. Clicking again on already selected axes shows a config panel for dataset under mouse - especially usable if many datasets are displayed using single axes. By default the select tool allows to choose only a child objects of the currently active axes. If you want to select an object and change the active axes you must double-click on the object. Double click over an empty area sets active axes to NULL.
By default all objects are created as child objects of the currently selected axes or as parentless objects if there is no active axes. Position of the child objects can be set as a relative to their parent axes, and they are deleted when the parent axes are deleted.
If you are working with Octave or Scilab you can use extensions to those packages provided with KMatplot. Each extension consist of a group of functions, which connect with KMatplot application through an unix socket. They can be used in the same way as internal graphics functions offered by both programs.
Scilab functions are not loaded automatically. You have to load them before use. Simple loading script is provided in 'scilab/plots.sci'. It should be executed each time Scilab is started by typing exec('plots.sci').
Functions defined in binary file plots.o:
ksetapp
Sets the active application. See View/I/O info to find out a number of a running app.
Usage: ksetapp(app_number), curr_app_number = ksetapp()
kaddaxes
Adds a new axes object. If KMatplot is not running it will be started. Available types: 0 - 2D axes, 1 - 3D axes.
Usage: axes_number = kaddaxes(axes_type)
kremoveaxes
Removes an axes object.
Usage: kremoveaxes(axes_number)
ksetaxes
Sets the current active axes ( all comands will be directed to this axes object ). See View/I/O info to find out a number of the currently selected axes.
Usage: ksetaxes(axes_number), curr_axes_number = ksetaxes()
kadd
Adds a new dataset to the current axes: Available types: 0 - curve, 1 - image, 2 - contour, 3 - surface, 4 - figure.
Usage: dataset_number = kadd(dataset_type)
kremove
Removes a dataset.
Usage: kremove(dataset_number)
kremoveall
Removes all datasets.
Usage: kremoveall()
ksetmatrix
Sets a matrix as a plot channel. See Edit/Current axes/Workseet to see descriptions of channels.
Usage: ksetmatrix(dataset_number,channel_number,matrix)
Functions defined in *.sci files:
kplot
:
kplot(x,y) - plots rows y versus rows x, or rows y versus vector x
kplot(y) - plots rows y
kcontour
kcontour(z) - plots z-contour
kcontour(x,y,z) - plots z contour versus x,y rows. x,y must be monotone
kimage
:
kimage(gray) - plots matrix gray
kimage(x,y,gray) - plots matrix gray versus vectors x and y. length(x) = cols(gray)+1, length(y) = rows(gray)+1. x and y must be monotone
kimage(r,g,b) - plots rgb matrices
kimage(x,y,r,g,b) - plots rgb matrices versus x,y vectors.
kmesh
:
kmesh(z) - plots z-surface
kmesh(x,y,z) - plots z surface versus x,y rows. x,y must be monotone
kmesh(facets_x,facets_y,facets_z) - plots figure
Examine sources for a short description of usage.
Note: The Scilab support is not distributed with the binary version of KMatplot.
Octave functions are distributed with the binary version of KMatplot and are installed
in the directory where Octave's scripts resides ( This is /usr/share/octave/site/m
on my RH ),
so you should be able to invoke them immediately after installing KMatplot. They are almost identical
as those for Scilab (see above). You can also type 'help program_name' from Octave's command line.