xyplot

produce x-y plot for binary or ASCII data

Usage

xyplot [options] [file]

Description

xyplot is a program which is practically useful and at the same time a good example for the use of the simplot routines. The source can be a convenient starting point for your own applications.

xyplot reads a file (or standard input by default) containing coordinates of datapoints and perhaps markers for those points, and plots it. Data must be sorted on x, or part of the data may be lost on expansion. This is because xyplot otherwise would not be able to efficiently handle expansion of large amounts of data. The file may either be an ascii file with 1 to 3 columns, or it may be a binary file.

Ascii files may have comment lines starting with # and comments (not necessarily starting with a #) may be added after the two numbers on a line.

Without one of the options -w, -o or -n, an ascii input file is assumed, and xyplot reads the columns that are plotted in an x-y frame. The number of columns in an ASCII file depends on the options -1 and -m:
(no options)
two columns, with x and y values; a third column, with markers, may be present, but will not be used.
-1
one column, with y-values; the corresponding x-values are assumed to be 0, 1, 2, ... etcetera.
-m
three columns: x-value, y-value, and a marker which is plotted instead of a dot.
-1 -m
two columns: y-value and a marker.
A marker may have up to 7 characters. The last one of these characters may be given a special significance: If a file .xycolors exists in the current directory, and its first column contains this last character, the marker, less its last character, will be plotted in the color defined in columns 2 (red), 3 (green) and 4 (blue) of this file. If the marker becomes empty after removal of its last character, a dot will be plotted in that color. So if .xycolors contains:
X 1 0 0
then a marker testX will be plotted as test in red. A marker X will generate a red dot.

Options

Options -w, -o and -n cause the input file to be considered a binary file. In that case binary words are read and each word is considered a y-value. The corresponding x-value is set to the next available integer, starting at 0. Thus the first y-value will have x=0. Numbers quoting datalength or offset may contain a trailing k,K,M,or m, which multiplies the number with 1024 or 1024x1024. Especially useful for offsets is a trailing w, setting the offset count in units of a word, or a trailing D, setting the offset count in units of displayed datalength.
-ssets stick mode (see Section Keystrokes)
-csets connect mode (see Section Keystrokes)
-gsets grid on
-w wordlengthsets the length of the word to be read in bytes; default: 4 bytes
-o offsetsets the number of bytes to be skipped at the start of the file
-n datalengthsets the length of the data in words. Used to cut off the end of the file
-x xtextsets the string plotted along the x-axis
-y ytextsets the string plotted along the y-axis
-t textsets the string plotted in the lower left corner; default: the filename
-1(default for binary data): the datafile contains only y-data, x's are set to 0,1,2,3,...
-mthe dataset has an extra column containing a marker of up to 7 characters. These markers are used instead of bullets to mark the datapoints, as described before.
-X Xsizesets the axes lengths (both x an y) in mm; default: 120
-Y Ysizesets the y-axis length (only y) in mm; default: same as x-axis length.
-D dotsizesets the dot size in mm; default: 1
-d degreesets the polynomial degree; default: no polynomial
-H symbol heightsets the symbol height; default 3, minimum .8, maximum 8
-l countmakes for count digits left of the y-axis; useful if you generate several pictures and them to be all the same width.
-bno X display presented, PDF plot generated
-Bno X display presented, PDF plot generated and sent to the plotter

Keystrokes

Several keystrokes are available that influence the display interactively. Some of these make use of a number (the current number) that has been typed before hitting the key:
F1Help. Shows the available keystrokes. Pressing F1 again returns the xy display.
cToggle connection lines between points. Initially, points are shown without interconnecting lines.
dSet polynomial degree to current number. Initially, no polynomial is shown. Typing a number (including 0), followed by d, shows the best fit polynomial of degree number through the points. A space, instead of a number, can be used to clear drawing a polynomial. The r-key may be used to show the residuals of the polynomial fit. This may be useful when looking for a good polynomial representation for a set of datapoints.
DSet dot size. Initially points are shown as 1 mm dots. This may be changed with the D key, preceded by a number. A zero number or no number at all removes the dots.
eToggle plotting of even points only.
fFourier transform the data or (if current number is non-zero) transform them back
gToggle grid-plotting.
Idifferentiate.
iintegrate.
ltoggle labeling.
mPrint the pointer's current x and y to stdout.
MPrint all x and y to stdout.
oToggle plotting of odd points only.
OOutput differences datafile. The y-differences of the datapoints are written to a file with the same name as the input file (or xyplot, if input was from standard input) with a .txt extension. This is of course only useful for equidistant data.
pPlot to a PDF file.
PPlot to the plotter (an appropriate PDF conversion filter is assumed to be installed).
qQuit
rToggle residual plotting. The differences between the y-values of the datapoints and the y-values for the current polynomial are shown instead of the datapoints themselves. Pressing r again returns to the datapoint display.
sToggle stick mode. In stick mode, datapoints are shown as sticks at position x with height y. This mode is especially useful for the detection of clustering in large amounts of data. The option m may be useful to output the x-values separating the clusters to standard output.
Ssmooth, using current number as smoothing range.
wWrite out 4-byte integer binary. The y-values of the datapoints are written to a file with the same name as the input file (or xyplot, if input was from standard input) with a .out extension. This is of course only useful for equidistant data.
zZoom out by 10%.
[0-9.-]Used for entering numbers.
EscapeClear current number.
LeftMove left by half a screen.
RightMove right by half a screen.
MouseLeftdragExpand. A rectangle dragged with the left mouse button is expanded. Normally one presses the button on the lower left corner and releases it at the upper right corner. Starting and ending in other corners inverts the x- and/or y-axes. Pressing the left button and releasing at in the same position undoes the expansion, that is: the axes are fitted to the extremes of the data.
MouseMiddleDragTrack position and integrate. Dragging the mouse with the middle button pressed shows the current x,y position in the upper left corner, followed by the sum of the y-values of the datapoints that are between the initial position and the current position.

Examples

xyplot -o 1024 file             # wordlength 4, offset 1024 bytes
xyplot -o 1k   file             # wordlength 4, offset 1024 bytes
xyplot -o 1K   file             # wordlength 4, offset 1024 words = 4096 bytes
xyplot -w 2 -n 33 -o 10D        # wordlength 2, display only 33 words,
                                # offset 10*33*2=660 bytes
xyplot -w 2 -n 33 -o 11D        # look at the next chop of 33 words
The SIMPLOT distribution contains a data file xy containing the coordinates and names of all Dutch cities and villages. You can display these by running xyplot:
xyplot xy    # displays a dot for each entry
xyplot -m xy # displays the name for each entry
The first of the two shows this picture:

xy