| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
10. MGL interface
MathGL library supports (from version 1.3) the simplest scripts for data handling and plotting. These scripts can be used independently (with the help of mgl2png, mgl2eps, mgl2svg programs and others) or in the frame of the library using.
MGL script language is rather simple. Each string is a command. First word of string is the name of command. Other words are command arguments. Command may have up to 1000 arguments (at least for now). Words are separated from each other by space or tabulation symbol. The upper or lower case of words is sufficient, i.e. variables a and A are different variables. Symbol ‘#’ starts the comment (all characters after # will be ignored). The exception is situation when # is a part of some string. Also options can be specified at the end of string (after symbol ‘;’, see section Command options (MGL)).
If string contain references to external parameters (substrings ‘$0’, ‘$1’ ... ‘$9’) then before execution the values of parameter will be substituted instead of reference. It allows to use the same MGL script for different parameters (filenames, paths, condition and so on).
Argument can be a string, a variable name or a number.
- The string is any symbols between ordinary marks ‘'’.
-
Variable name is arbitrary combination of symbols (except spaces and ‘'’) started from a letter and with length less than 64. It is possible to use sub-arrays (like in
subdatacommand) as command argument. For example,a(1)ora(1,:)ora(1,:,:)is second row,a(:,2)ora(:,2,:)is third column,a(:,:,0)is first slice and so on.If names for data columns was specified (by set_id command or in the file at string started with
##) then it is possible to use any column combinations defined by formulas, likea('n*w^2/exp(t)'). -
Special names
nan=#QNAN, pi=3.1415926..., on=1, off=0, :=-1are treated as number if they were not redefined by user. Also variables with suffixes are treated as numbers (see section Suffixes for variable).
Before the first using all variables must be defined with the help of commands, like, new, var, list, copy or read.
All MGL commands can be divided on several groups. I will use the following notation for a command description: command names are bold, strings are denoted by commas, variable names are italic, numbers are typewriter. Optional arguments are placed in square brackets and default values for them are shown. Detailed description of color, line styles, color schemes, font types, TeX-like symbols and formulas can be found in corresponding section.
| [ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
