home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: Science
/
Science.zip
/
ABCPLOT.ZIP
/
ABCPLOT.DOC
next >
Wrap
Text File
|
1991-04-02
|
16KB
|
297 lines
Command: abcplot
Usage: abcplot {datafile} [options]
Description:
ABCPLOT is a simple graphing utility that quickly plots
scatterplots of data. Data can originate in a file or in
standard input. ABCPLOT gets all its information (except the
data to be graphed) from the command line. Results are
printed to standard output (optionally to a specified file).
The plot is by no means high-quality, but it is very fast and
can be an easy way to scan a dataset for relationships
among variables.
ABCPLOT plots a dataset using characters such as A,B,C. The
plot is an XY-graph, where the plotting symbols represent a data
record's location in an X-Y coordinate system. Up to 10 dependent
variables (y-variables) can be plotted, and are represented by
different plotting symbols (A through J). Only one independent
variable (x-variable) can be specified.
If the command line indicates a categorical variable, ABCPLOT
will represent the category by the plotting symbol. A categorical
variable cannot also be used as an x- or y-variable, and must
have 10 or fewer unique values. Additionally, each value of the
x-variable must be repeated for each category. Categorical variables
are valid only if a single y-variable is specified.
Arguments:
datafile - ASCII file with data to be graphed. The file must
have at least 2 lines. Aside from header-comment
lines (more on those later), the file must contain
only numbers that are readable by FORTRAN in list
format (i.e., delimited by commas or spaces);
each line of the file must contain the same
number of fields (but lines don't have to be the
same length). Currently, file size is
limited to 3000 lines and 100 variables.
If datafile is not specified, data are assumed
to be present on standard input, and ABCPLOT will
wait for an end-of-file mark before processing
the data stream. The same restrictions on file
size apply to the size of the data stream.
The file can contain header-comment lines which
document the data file. These lines must have
a special character ( one of !#"* ) in the first
position of the line. Any number of header-comment
lines is allowed, as long as they precede the data.
Header-comment lines are disregarded by the
plotting routines and have no effect on the plot.
Options:
If no options are specified, the defaults are : -x 1 -y 2
Options are case insensitive.
-x n - Specify column n as independent variable.
If -x 0 is used, the sequence number of the
data record is used as the x-variable.
-y n1 {..n10} - Specify column(s) ni's as dependent variable(s)
(up to 10).
-o {outfile} - If specified, the plot will be written to a file.
This plot will have more resolution (132 characters
across) than the plot that is written to standard
output (78 characters across). To print this file,
either wide paper or a small point size should be
used.
-c n - specify a column containing category variable with
up to 10 unique values. If a categorical variable is
identified, ABCPLOT will represent the category by the
plotting symbol. A categorical variable must not be
used as an x- or y-variable; it must have 10 or fewer
unique values; additionally, each value of the x-
variable must be repeated for each category.
Categorical variables are not recognized if more than
one y-variable is specified.
-s Switches X and Y axes. This is useful when you have
several dependent variables to be graphed in the
horizontal dimension.
-n Produces numerical output instead of a plot. This
is useful when a categorical variable has been used,
and you want to organize the data so each field of the
new dataset contains the value of the y-variable for a
value of the category variable. This may make it
easier to send the data to other applications such as
Cricket Graph or a spreadsheet. This option can also
be useful when the accuracy of the plot is in
question. See example 4.
The -n option allows ABCPLOT to perform the work of my
related utility, FOLDIT. FOLDIT is now obsolete.
Examples:
1. If the file 'data1' contains the lines:
10 1.5 1.8
15 1.8 1.4
20 2.3 1.2
5 1.1 2
4 1 1.5
-- Then the command,
abcplot data1 -x 1 -y 2 3 -- produces ...
+---------------+---------------+---------------+---------------+
0.230E+01 + A+
0.222E+01 + +
0.215E+01 + +
0.207E+01 + +
0.199E+01 + B +
0.192E+01 + +
0.184E+01 + +
0.176E+01 + B A +
0.169E+01 + +
0.161E+01 + +
0.154E+01 +B A +
0.146E+01 + +
0.138E+01 + B +
0.131E+01 + +
0.123E+01 + B+
0.115E+01 + +
0.108E+01 + A +
0.100E+01 +A +
+---------------+---------------+---------------+---------------+
0.400E+01 0.800E+01 0.120E+02 0.160E+02 0.200E+02
2. If the file 'mydata' contains the lines:
0 1 1
0 2 3
5 1 1.5
5 2 3.2
10 1 1.8
10 2 3.5
15 1 2
15 2 3.6
20 1 2.5
20 2 3.8
25 1 2.5
25 2 3.2
30 1 2
30 2 2.8
35 1 1.5
35 2 2
40 1 1.4
40 2 1.8
45 1 1.3
45 2 1.3
50 1 1.1
50 2 1.01
-- Then the command,
abcplot mydata -y 3 -- produces...
+---------------+---------------+---------------+---------------+
0.380E+01 + A +
0.364E+01 + A +
0.347E+01 + A +
0.331E+01 + +
0.314E+01 + A A +
0.298E+01 +A +
0.281E+01 + A +
0.265E+01 + +
0.248E+01 + A A +
0.232E+01 + +
0.215E+01 + +
0.199E+01 + A A A +
0.182E+01 + A A +
0.166E+01 + +
0.149E+01 + A A +
0.133E+01 + A * +
0.116E+01 + A+
0.100E+01 +A A+
+---------------+---------------+---------------+---------------+
0.000E+00 0.125E+02 0.250E+02 0.375E+02 0.500E+02
-- The * symbol indicates that more than one point occurs at that
-- position.
3. However, the command,
abcplot mydata -y 3 -c 2 -- produces...
+---------------+---------------+---------------+---------------+
0.380E+01 + B +
0.364E+01 + B +
0.347E+01 + B +
0.331E+01 + +
0.314E+01 + B B +
0.298E+01 +B +
0.281E+01 + B +
0.265E+01 + +
0.248E+01 + A A +
0.232E+01 + +
0.215E+01 + +
0.199E+01 + A A B +
0.182E+01 + A B +
0.166E+01 + +
0.149E+01 + A A +
0.133E+01 + A * +
0.116E+01 + A+
0.100E+01 +A B+
+---------------+---------------+---------------+---------------+
0.000E+00 0.125E+02 0.250E+02 0.375E+02 0.500E+02
4. And the command,
abcplot mydata -y 3 -c 2 -n -- produces...
0.000000E+00 1.000000 3.000000
5.000000 1.500000 3.200000
10.000000 1.800000 3.500000
15.000000 2.000000 3.600000
20.000000 2.500000 3.800000
25.000000 2.500000 3.200000
30.000000 2.000000 2.800000
35.000000 1.500000 2.000000
40.000000 1.400000 1.800000
45.000000 1.300000 1.300000
50.000000 1.100000 1.010000
-- Note that the above numeric output places each unique X-value in the
first field; the second field contains the value of the Y-variable
where the categorical variable takes its first unique value
(i.e., 1 in this dataset); the third field contains the value of the
Y-variable where the categorical variable takes its second
unique value (i.e., 2 in this dataset).
-- Beside plotting data from a file, ABCPLOT will also accept data from
-- standard input.
5. If we have a FORTRAN program which generates data to standard output
as follows,
-- PROGRAM GENDAT
-- DO T=1.0,20.0,0.1
-- PRINT *,T,SIN(T),COS(T),SIN(T)+COS(T)
-- END DO
-- END
-- After compiling and linking (assume the executable file for
the program is 'gendat.exe'), we can use the command:
gendat | abcplot -x 1 -y 2
-- which produces...
+---------------+---------------+---------------+---------------+
0.100E+01 + *** A** A** +
0.882E+00 +*A AA A* A* * * A+
0.764E+00 + * * AA * * AA+
0.647E+00 + * A A AA A * +
0.529E+00 + A * AA A * A +
0.411E+00 + A A A A A A +
0.294E+00 + * A A A A AA +
0.176E+00 + A A * * A A +
0.586E-01 + A * A A AA A +
-.590E-01 + A A A A A A +
-.177E+00 + A A A A A A +
-.294E+00 + * A A A A AA +
-.412E+00 + A AA * * A A +
-.530E+00 + A A A A AA A +
-.647E+00 + AA AA * * A * +
-.765E+00 + * A A * AA AA +
-.882E+00 + * *A *A AA A* * +
-.100E+01 + **A *** A** +
+---------------+---------------+---------------+---------------+
0.100E+01 0.573E+01 0.105E+02 0.152E+02 0.199E+02
Related Utilities:
MKTAB -- (Available from me). Replaces blanks separating fields in a data
file with tabs. Useful for importing data into applications such
as Cricket Graph or Excel.
DTAB -- (Available from me). The opposite of MKTAB, it replaces tabs with
blanks. Designed to clean up FORTRAN code, but it works fine with
data files.
AWK -- (Available from various sources). A ubiquitous utility,
originally found on UNIX systems, which processes data files.
Can be used to filter data prior to plotting.
GNUPLOT-- (Available from various sources). Produces graphic plots which
are prettier and more verstatile than ABCPLOT's. But it requires
that the input file have only one dependent variable, so it cannot
use multiple Y-variables or categorical variables. Multiple-field
datasets have to be artfully processed with AWK and/or other
utilities before GNUPLOT can graph them. This is usually not
necessary with ABCPLOT. Also, ABCPLOT's output, being text, can be
printed on any printer or written to any ASCII file.
CONV77 -- (Available from me). Scans a FORTRAN source file and replaces the
non-standard DO ... END DO constructs, with numbered DO n ...
n CONTINUE constructs.
ABCPLOT was written by Bob Dougherty. Command-line parser by Ryan Rumanang.
Standard input enhancement by Rudy Ting Liang.