# PLOTXY: A VERSATILE PLOT PROGRAM

Robert Parker and Loren Shure

QUICK INDEX

accumulating data: plot, save
annotation: note, xlabel, ylabel
arrows: note
axis numerals: character
box: frame
captions: note
changing letter size: character, LETTERING
deleting data: cancel, save
discrete points: symbol
displaying results LOCAL IMPLEMENTATION
dotted lines: dash
end of file on input: read
error bars: mode
fancy lettering: LETTERING
filenames: file, output
fonts: LETTERING
Greek letters: LETTERING
grid: frame
interpolation: smooth
labeling curves: note
labels: xlabel, ylabel
ine thickness: weight
log axes: logxy
naming axes: xlabel, ylabel
naming datafiles: file
naming graphs: title
naming plotfiles: output
no axes: frame
no box: frame
no axis numerals: frame
offset data: affine, offset
page orientation: landscape
plotting the graph LOCAL IMPLEMENTATION
removing data: cancel
reversed axes: xlimit
rewind datafile: file
scaling data: affine
separate x & y data files: mode
size of graph: xlimit, ylimit
size of letters: character, LETTERING
size of symbols: symbol, mode
skipping records: skip
spline interpolation: smooth
stacking curves: affine, offset
stacking graphs: plot, stack
subscripts in labels etc: LETTERING
superposing plots: plot, NOTES
superscripts: LETTERING
suppress ticks: character
suppress axes: frame
tables, scanning: mode, format
tick marks: xlimit, ylimit
tick marks only: frame
variable symbol height: mode=3
y data only: mode

INTRODUCTION

Plotxy is a program for generating graphs from data files with a minimum amount of fuss. In the simplest case, data points have been generated as x-y pairs in an ASCII file called xydata perhaps written with a formatted FORTRAN write statement or created with an editor. The program reads the file, and plots y as a function of x, interpolating with straight lines; axes are automatically assigned with reasonable limits and annotations. All this can be done with the three commands

plot
stop

Here a data file with the name xydata has been read format-free (that is with * instead of a format in FORTRAN). An diskfile named mypost has been written; its contents may be plotted on any of the standard devices with a plot filter. As documented in the rest of this writeup, it is possible to add embellishments of considerable complexity: for example many series on one plot, plotting of symbols at the points, cubic spline interpolation of continuous curves, logarithmic scales, error bars, titles, axis labels and all the other common desiderata.

The program operates from a simple command line language. You are not prompted but instead you must enter instructions to tell the program which options are needed. Almost every option has a default value, so that if nothing is mentioned about a particular parameter the default is taken: for example, the default plotting scales are linear in x and y. Once a particular option has been invoked, it remains in force until altered. (Exceptions: stack and fill).

BASICS

Upon execution the program prints the single prompt:

Now you must type commands selected from the catalog below; each command begins in the 1st position of a new line; it may be followed by some literal or numerical parameters, which must be separated from the command word by a space. Any command may be abbreviated by its first four characters.

To read data from an external disk file there are several commands defining the attributes of the data to be input; an obvious example is the name of the disk file, defined by file; other input attributes are things like whether this data set is to be connected with a smooth interpolating curve (smooth) or to be plotted as individual points (symbol). Having set up all the necessary specifications, you perform the actual input with the read command. A second data series may be read by using read again. The numbers may come from the same file or, by resetting the input attributes as required, a different one. All the parameters remain in force from the previous read unless they are specifically altered. Each of the data series with its different properties is accumulated in memory ready to be plotted.

Plotting is accomplished with plot. If several data series have been read since the previous call to plot, or this is the first such call, they all appear on one graph. Actually all that is done by this command is to create the file mypost which must be displayed or sent to a printer after plotxy has halted. Some parameters apply to the whole plot, and may be set at any point before plot. For example, there are the x and y axis labels (xlabel, ylabel) and the plot title (title). The size of the plot defaults to 6 inches in x and 8 in y; the limits of the plot defaults to values slightly larger than the extremes found in the series. These things can be overridden using xlimit and ylimit. When all the data are strictly positive, logarithmic scales can be set with logxy.

Before typing plot it is sometimes helpful to inspect the series and the way in which the data are going to be interpreted. This is done with status, which provides a synopsis of each data series and most of the current parameter settings.

Additional graphs may be created by reading in more data and invoking plot again as often as necessary. To terminate the program type stop. The program halts and the plotfile can be displayed or printed.

COMMAND CATALOG

The commands are given their full English names here (though only four characters are needed). Commands may be given in upper or lower case letters. The characters following the first blank after the command word itself are termed the command field'. A command line may be 120 characters long. Parameters that may be omitted in the command field are enclosed in square brackets. The parameters may be numbers, file names or text; it should be obvious from the context which is appropriate. A list separated by slashes denotes a set of possible alternative items. A line beginning with one or more spaces is ignored and may be used as a comment. In mathematical formulas an asterisk denotes multiplication and double asterisk exponentiation.

affine a b c d

Transforms the x and y coordinates of the next and subsequent data series to be read according to new(x) = a*x + b, new(y) = c*y + d. This is an affine transformation.

Blank command field a = 1, b = 0, c = 1, d = 0

cancel [n]

Removes the last n data series read into memory. If no series has been read in, do nothing.

Blank command field n = 1

character h [angle]

Change the height of the lettering in titles, labels, notes and axis numbering to h inches. The new value applies to the next piece of text to be read, so that different height letters can appear in the title, the axis notations, etc. The value of h just before plot determines the height of the axis numerals; if this is zero, axis numerals and tick marks are both suppressed (also see frame). The optional parameter angle specifies the angle at which text will be plotted in the next note. Letter height can also be controlled by the a special text phrase (see LETTERING).

Default h = 0.15, angle = 0

color color

color n

On those devices capable of color, this command sets a new color from the list: black, red, blue, green, brown, orange, yellow, purple, gray, white (useful for drawing on top of dark curves). Colors may be referred to by number: 0 or 1 black, 2 red, 3 blue, 4 green, 5 brown, 6 orange, 7 yellow, 8 purple, 9 gray, 10 white. This describes the PostScript implementation, but there may be variations depending on hardware. The color of a plotted data series is the one set at the time of the associated read command; similarly with labels, notes, etc. Also the axes and the frame are drawn in the color specified at the time plot is called.

Default black

dash [s1 s2]

Plot the next data series to be read in as a dashed line, with visible segments s1 inches long and missing segments s2 inches long. dash is an input attribute applying to the next read command. To return to an unbroken curve, set s1 or s2 to zero.

Default s1 = 0, s2 = 0

Blank command field s1 = 0.2, s2 = 0.1

file filename

Defines the file name of the external disk file from which data are to be read; or the symbol * which implies read from the console. The name must consist of 64 or fewer characters. After this command the next read statement will begin at the beginning of the file.

Default = xydata

Blank command field = Rewind existing file

fill

In the PostScript model only, fills a closed polygon based on the next input series with the current color. A closed curve is created by joining the first and last points of the series with a straight line. Fill, unlike most commands, does not remain in force, but applies only to the next read. This command is incompatible with modes 3 and 30. Polygonal symbols (e.g. hexagon) are drawn filled when this command is on. If parts of the curve go outside the plot window, the results are unpredictable.

format (format specifier)

Defines a format for reading the next data series from an external disk file. The format specifier may be (1) a normal FORTRAN format specifier enclosed in parentheses; (2) the single character * meaning format free' reading; (3) the character b meaning a binary read. In each case the data are read with a single FORTRAN read statement of the appropriate type. Usually, if the numbers can be unambiguously read by a person without the need to skip certain columns or other tricks, there is no need to use an explicit format - the default * works well. Never use an I format because values are stored as REAL variables; thus a number written with I4 must be read with an F4.0 format. Always remember the space after the word format and the parentheses.

Default = *

Blank command field = *

frame on/grid/off

frame -xnum -ynum -xaxis -yaxis

frame top/bottom left/right

If on is present, two more sides are added to the axes to complete a rectangular frame around the plot; grid includes a lightly dashed grid corresponding to the axis tick marks as well as a frame; off cancels the surrounding box and returns to the normal situation with two orthogonal axes.

The second form of the command allows you to delete the numerical annotation from either axis: with -xnum the numbers are removed from the x-axis; with -ynum from the y-axis. The tick marks remain; they may be removed by setting the character height to zero immediately before plotting. Numbers can be restored with +xnum and +ynum. Similarly a complete axis may be removed with -xaxis or -yaxis, and restored later with plus signs. When contradictory options are issued (-xaxis and +xaxis both present, for example) the program takes the option omitting the least amount of information.

The third form allows the user to draw an axis on the wrong side of the graph: at the right or at the top; the labels move with the axes. Obviously bottom and left restore the axes to their conventional locations.

Default off

Blank command field on

help

Lists the four-letter abbreviation of all the commands. This may remind you of a name you have forgotten. Some systems also allow access to the documentation file.

landscape

In the PostScript version, causes the output to be rotated by 90 degrees clockwise, that is, landscape mode. The command must be issued before the first plot command in order to be effective. The orientation state cannot be changed back to the conventional (portrait) style unless a new plotfile is created with output. Then, when the command is used a second time, before the first plot on the new file, the state is reversed from its current one.

logxy [style]

logxy [n]

Specifies the type of scales for the next plot with one of the following styles: linlin, loglin, linlog, loglog, where the first syllable describes the x axis, the second the y axis, so that loglin means the x axis is logarithmic and the y axis linear, and so on. The style may also be specified by an integer: 0 linlin, 1 loglin, 2 linlog, 3 loglog.

Default linlin

Blank command field loglog

mode n [col1 col2 col3]

Defines how the input data are grouped in the next and subsequent reads. The integer n may be 1, -1, 2, 3, -3, 4 or 10, -10, 20, 30, -30: 1 implies data are simply consecutive y values with uniformly increasing x values beginning at x = 1 with unit increment (these x values may be modified with affine); -1 means that only x values are read and that y increases evenly from 1 with unit increment; 2, the default, means data are x y pairs; 3 means data are x y z triples in which z is taken to be the uncertainty in y (thus a bar is plotted between y-z and y+z). -3 means use third member of data group as an uncertainty in the x-value. A symbol may be plotted at the actual value of y itself if symbol is set; to guarantee the absence of a symbol put s = 0 in symbol. If s is set greater than or equal to 10, the symbol is drawn with height z instead of the bar. When mode is 4 the x and y data must be read by separate read commands, the x series being input first. The series length is that of the x series.

In mode 10 it is assumed the input file is in the form of a table, and a single column is picked to be plotted against uniform x; the selected column is the second argument, col1. With -10 x is plotted against uniform y. Similarly 20 is like mode 2, allowing you to read two columns from the table. An example is mode 20 5 2, which means column 5 is used for x and column 2 for y in the x-y series. Modes 30 and -30 are similar, picking the three columns from the table in the obvious way. In these modes any supplied format is ignored and replaced by *. Chaos results if there are too few numbers in any row of the table.

Default n = 2

Blank field after n = 10,20,30, col1 = 1, col2 = 2, col3 = 3

note (x y [in]) text

note (p q x y [in]) text

note filename

In the first two options above, reads the characters of text to be plotted on the graph at the coordinates x, y (which do not participate in the current affine transformation). The text may be up to 80 characters in length. If the optional in appears the coordinates refer to the bottom left corner of the first text character, measured in inches from the intersection of the axes; otherwise x, y are in the units of the graph. Notice the parentheses surrounding the coordinates are mandatory. The height of the plotted characters is the value h in the most recent character command. Similarly the angle the text makes with horizontal is the one previously set in character. To see how many separate notes are allowed in your version of plotxy, enter status (20 is usual). To clear the notes enter note and a completely blank command field (this means omitting the coordinates, of course); this must be done explicitly for new graphs to begin a fresh set of notes.

If four coordinates instead of two appear in the parentheses, an arrow is drawn with its tip at p, q and its tail tastefully near the text, which is plotted as before with x, y at the bottom left of the first character. The text is always horizontal with this option. If no text accompanies a four-coordinate note, the arrow tail goes exactly to the second position.

The following option allows a large number of short notes to be read from an external file. When a filename follows the command, coordinates and notes (one set per line) are read from the named diskfile to its end. Up to 300 such notes can normally be read (Use status to check this). Each note in the notefile is at most 16 characters long and the whole series comprises horizontal text, homogeneous in character size and color specified at the time when the file is read. Font changes can be induced in the usual way by phrases in the notes themselves. The coordinates are in graph units only and must not be enclosed in parentheses. These notes are canceled with call to note with a blank command field just like those specified as commands. If it is desired to begin the note with a space, terminate the coordinates with a comma; spaces after the comma are part of the note.

Blank field = delete all old notes

offset [dx dy]

When several similar data series are to be displayed together it is often convenient to introduce a displacement between them to clarify the picture. Thus if dy is nonzero at plotting time, the nth series will be plotted with values of y + (n-1)*dy, where y is the input value. Similarly with dx. When a logarithmic scale is used, the data are plotted as y*10**((n-1)*dy) to preserve equal apparent displacement on the graph. Notice all the series are displaced whenever offset is invoked; for a more flexible method of offsetting data see affine.

Default dx = 0, dy = 0

Blank command field dx = 0, dy = 0

output filename

Defines the name of the plot file to be filename, which must be composed of 64 or fewer characters. Every time output is issued, the currently opened plot file is closed and a new one opened ready to receive further plots. Suppose you make a mistake; if you enter the command output without a filename the current plotfile is erased. Subsequent output is sent to the current file which has been re-initialized.

Default = mypost

Blank command field: restart plot on current file

plot [x0 y0]

Creates the next complete graph containing all the data series currently in memory. Unless a save command has been used, the plotted series are the ones read in since the last plot command or, if this is the first such command, all the series. A plot file is generated named mypost, unless you have set a different name with output. Usually plot is invoked with a blank command field but, if x0 and y0 are specified, the new graph is plotted with its origin at those coordinates in inches relative to the previous plot origin. The plot origin for these purposes is the place where the annotated axes cross, not the point (0, 0).

save

When new points are read after a plot command, the data values for the previous graph are erased. To prevent this, the command save must be entered before the next read statement; then the old and the new data are plotted together on the new graph. If no new data are to be read in, there is no need to use save since the earlier data are retained for plotting in this case.

smooth [on/off]

Decides whether continuous curves of y against x are interpolated with straight lines, smooth off, or natural cubic splines, smooth on. When splines are used, the series is taken to be a single-valued function of x and the actual x values are re-ordered to be increasing by the program if necessary. This command is an input attribute, applying to subsequent read commands, not to the whole plot. smooth on cancels a symbol command and vice versa. smooth off reverts to symbol mode if that was the previous style of plotting, with the same symbol number and height as before. Note the automatic plot limits use the original data series, not the smoothed values, so that sometimes pieces of a smoothed curve may be lost off the top or bottom of a graph even when you have let the program find its own limits.

Default = off

Blank command field = on

skip [n]

Skips the next n records in the current data file. With ASCII files this means skipping n lines. The command examines the current read format to determine whether the current file is binary or ASCII. Although skipping can be performed by including slashes in a format specification it is often more convenient to use skip.

Blank command field n = 1

stack

Causes the next complete graph, including axes, titles etc, to be drawn above the previous one with enough space to give a pleasing appearance. To stack several curves on one graph see affine or offset. This command is turned off internally after plot to prevent accidental plotting off the top of the paper. A more flexible way of organizing the relative positions of several complete graphs is by means of plot with origin parameters.

status

Lists a synopsis of the current data series (their lengths, extreme values and other attributes), the plot and reading parameters, and the number of words available for further data series. Also lists the program array limitations of the current version you are running.

stop

Closes the output file and brings program to an orderly halt. This must always be the last command of any run, otherwise part of your plot will be lost.

symbol n [s]

symbol name [s]

Defines the next input series to be a set of discrete points with symbols rather than a curve. The approximate height each of symbol is s inches, the type of symbol defined by the integer n in the first style:

Small symbols (16, 19, 20 and 21) are about half the regular height, while 18 is about twice the stated height. To cause one of these symbols to be drawn in a text string (a note for example) just enclose the symbol number plus 2000 in backslashes, for example, \2019\. The value of n may be used to reset the input of continuous data: n = -1 or the word off means next data read will be continuous with straight line interpolation; n = -2 means go to cubic-splined curves. If the size s is omitted, the value from the previous symbol command is inherited.

A subset of the symbols can be referred to by name instead of the integer code: asterisk, circle, cross, diamond, dot, hexagon, octagon, plus, square, star, triangle and the solid symbols specified by prefixing filled or solid in front of circle, square and triangle.

Default n = -1, s = 0.15

List of Symbols

 0 square 8 upward arrow 8 upward arrow 1 triangle 9 hourglass 17 circle 2 octagon 10 campstool 18 large circle 3 diamond 11 hexagon 19 small filled disk 4 plus 12 Y 20 small filled square 5 asterisk 13 vertical bar 21 small filled triangle 6 cross 14 star of David 7 barred square 15 dot

List of special symbol codes

 1387 curly d 1388 del 1389 member of 1390 less or equal 1391 greater or equal 1392 proportional 1393 integral 1394 circuit int 1395 infinity 1396 + or - 1397 - or + 1398 times 1399 division 1400 product 1401 times dot 1402 radical 1403 summation 1404 regular theta 1405 { 1406 } 1407 @ 1408 hat 1409 [ 1410 ] 1411 # 1412 paragraph 1413 dagger 1425 tall < 1426 tall > 1429 degree 1430 tends to 1431 regular phi

title text

Specifies a title for the plot. This may be up to 115 characters in length. A blank command field cancels the previous title and leaves the next plot untitled. The character font of the title is assumed by all the lettering of the graph unless explicitly reset. If the title consists only of a font-setting phrase, the font is set and the graph is untitled.

Default text = blanks

xlabel text

Specifies a label to be written centered below the x axis. See title for other details.

Default text = blanks

xlimit xlength [x1 x2]

xlimit xlength [x1 x2 dx]

Defines the length of the x axis, xlength, in inches and the lower and upper limits of x: x1, x2. All plotted points lie inside (x1, x2); those outside are omitted from the plot. If x1 = x2 = 0, or if these values are omitted in the command, the x extremes are chosen to encompass the values in the data series. If x2 is less than x1 the data and axes are plotted reversed, that is, with x decreasing to the right, between the given limits. Reversed logarithmic axes are not permitted. This is a plot attribute, governing the behavior when plot is invoked. If the fourth argument, dx, is supplied, tick marks and numbers are written at integer multiples of dx, provided this results in a reasonable quantity of them; otherwise, the defaults are invoked.

The default behavior for plot size is somewhat complex: if the x and y variables cover similar intervals (within a factor of two), the default height and width are arranged to be in the proportions of the data, thus giving the same scales for the x and y variables. Otherwise a height of 8 inches and width of 6 is taken.

Default xlength = 6, x1 = x2 = 0

ylabel text

Same as xlabel but for the y axis.

Default text = blanks

ylimit ylength [y1 y2 [dy]]

Same as xlimit but for the y axis.

Default ylength = 8, y1 = y2 = 0

weight w

On PostScript versions this command controls the weight of plotted lines by giving the integer w, the line thickness in one-thousandths of an inch.

Default w = 4

DEFAULT VALUES

affine 1, 0, 1, 0
output mypost
character 0.15, 0
smooth off
dash 0, 0
symbol -1, 0
file xydata
title blanks
format *
xlabel blanks
frame off
xlimit 6, 0, 0
logxy 0
ylabel blanks
mode 2
ylimit 8, 0, 0
offset 0, 0

LETTERING

Plotxy provides a variety of fonts in which the title, labels, notes may be written as well as the ability to include mathematical material and Greek letters. The names of the fonts are simplex, complex, italic, duplex; the default is the austere simplex. To get any of the others in a text string enclose the first three letters of the font name in backslashes (e.g. \ita\ or \dup\) ahead of the text. The font remains in force until explicitly changed. To obtain a uniform font throughout the graph and its labels include a font-setting phrase (e.g.\ita\) at the beginning of title. If you want to vary the fonts within one plot you must specify the desired font for each character string plotted. Font changes may appear at any point in a piece of text.

You may also get Greek letters by enclosing their names in backslashes, as \GAMMA\ or \lambda\; upper case Greek appears when the English name is upper case. The name of a Greek letter can be abbreviated to its fewest unambiguous leading letters: thus \s\ specifies sigma, but you need \ome\ for omega. Superscripts are possible with the construct \sup{...}, so that x-squared is rendered x\sup{2}. Similarly with subscripts one writes, for example, g\sub{ij}. As mentioned in symbol you may plot a special graphics symbol by enclosing the symbol integer plus 2000 in backslashes. The code \bs\ suppresses the character advance so that characters may be superimposed.

There are certain special characters with no keyboard equivalent. To get them you must use a special code: a 4-digit key number enclosed in backslashes. The code acts just like an ordinary character so that, for example, the space of infinitely differentiable functions would be written C\sup{\1395\} since \1395\ is the code for infinity. Here is a table of the codes for the special symbols; every symbol in the graphics character set has such a code but only 1387 to 1431 are given because all those without keyboard equivalents are contained in this list.

Finally, another use for the four-digit code is to specify text size. The height of the text following the phrase \0025\ is changed from its current value to 0.25 inches; any number less than 500 is interpreted as the letter height in hundredths of an inch, but remember there must be four digits between the backslashes.

NOTES

Plotxy is reasonably graceful with error conditions: explanatory messages are issued in most circumstances. The messages are usually in two parts: what went wrong and what the program has done about it. For example, if unintelligible data are encountered, the program reject the whole series and then issue a warning. Attempting to plot negative data on a log scale does not cause a crash - an error message is printed and the offending scale is made linear instead of logarithmic.

When smooth is used, the data series is re-ordered to make x increasing; if consecutive x-values are then identical, this implies a discontinuity in the function, which can not be smoothed. Plotxy issues a warning and plots the re-ordered series unsmoothed, that is, with points joined by straight-line segments.

If you have explicitly set plot extremes with xlimit and ylimit and a data value falls outside the window, when smooth is on the program draws a piece of curve between the last captured point(s) and the edge of the graph in the direction of the invisible point. When smooth is off the pen is simply lifted until onscale data are encountered. This allows you to insert breaks in your data records by inserting large values; remember to set limits explicitly at plot time.

To plot a line with symbols at the observations just read the data file twice, once with an interpolating line (smooth or not, as desired) and then with symbol. If you want lines with both long and short dashes this too can be done by reading the data twice each time with different, but compatible dash sizes, so that when superposed the desired effect is achieved. This is possible because plotxy is careful about dashed lines, always starting at the beginning of a drawn section. Not every combination of long and short dashes can be built this way, although a surprising variety can. For example, if you use

then one way to obtain a repeating pattern is to set c=(2*a-(n-1)*b)/(n+1) and d=(n*b-a)/(n+1), where n is an integer such that a/b < n < 1+2*a/b.

Artistic users seem to want to vary the font and size of every notation and label. This is straightforward: any piece of text may be preceded by a font phrase; the height may be defined in the text as described in the previous section or by the character command immediately before the text is entered (and similarly with color). The only writing that can not be specified in this way is the numerical annotation of the axes. To control its size and color set these parameters immediately before plot; to arrange a special font put the font phrase you desire at the end of the title text. If you want the two axes in different colors with different numeral sizes and fonts, this can be done too, but discovering how is left as an exercise.

Reversing x and y axes (as when coordinates are specified as latitude and longitude) is easily done with mode 20:

mode 20 2 1

Modes 10, 20, 30 are designed to read from tables in which the columns contain numbers only, not other kinds of material, such as code words. If you want to extract values from a table some of whose columns are not numbers, those columns can be skipped if you use an explicit format statement.

EXAMPLES

Here are two examples of quite presentable plots made with relatively little effort. The first is a reproduction of some graphs of Bessel functions found in Abramowitz & Stegun's Handbook of Mathematical functions. A rather sparse table has been entered equally spaced directly into the input file and the values are spline smoothed to add authority. All modern operating systems allow you to prepare an input file and submit it to a program as if it were entered interactively; it is very handy then to put the data in the file together with the plot commands. Notice comments have been inserted by beginning a command line with a blank.

A diagram from Chap 9 of Handbook of Mathematical Functions

file *
smooth
mode 1 0 1

First 16 values of J0 for x=0, 1, 2, .. 15

1.000 .762 .224 -.260 -.397 -.178 .151 .300 .172 -.090
-.246 -.171 .048 .207 .171 -.014

Now 16 values of J1

0.000 .440 .577 .339 -.066 -.328 -.277 -.005 .235 .245
.043 -.177 -.233 -.070 .133 .205

Next 15 values of Y0 for x=1, 2, .. 15 dashed

mode 1 1 1
dash .05 .07
.088 .510 .377 -.017 -.309 -.288 -.026 .224 .250 .056
-.169 -.225 -.078 .127 .205

Finally values of Y1

-.781 -.107 .325 .398 .148 -.175 -.303 -.158 .104 .249
.164 -.057 -.210 -.167 .021
xlim 3.5 0 16
ylim 3 0 0
title \dup\
xlab \com\FIGURE 9.1: \ita\J\sub{0}(x), Y\sub{0}(x),
note (1, 0.8)J\sub{0}
note (1.8, -0.5)Y\sub{1}
note (2, 0.577, 3, 0.8)J\sub{1}
note (3, 0.377, 5, 0.6)Y\sub{0}
plot 1 7

In the above listing the xlab command line has been truncated to fit on the page. Several different fonts have been used; notice the axis numerals are in the font of the title, which is in fact blank. The picture has been placed at the top of the page leaving room for the second example below it.

Next we illustrate how a table may be rescanned to pick out different columns for various purposes. The data file rhodata contains a table of Wenner array apparent resistivity data at various electrode spacings, together with an estimated uncertainty (column 3) and the fit of a one-dimensional theoretical model (column 4). The file is read in mode 30 to get error bars, then reread and smoothed to put the theory on the graph. Log axes are appropriate here for obvious reasons.

title \ita\
logxy 3
frame
xlim 4 1.0 1000
ylim 3.6 10 2000
ylabel Apparent resistivity \rho\\sub{a} (\OME\m)
xlabel Electrode separation r (meters)

1st read uses the format to pick measurements and

errors in mode 30

file rhodata
symbol 19 0.1
mode 30 1 2 3

2nd read picks up 1st and 4th column with mode 20

mode 20 1 4
dash 0 0
smooth
notes
plot 0 -5.5
stop

Here is the data file rhodata

1.52 69.6 10.0 67.9
4.57 126.3 21.1 126.3
7.62 207.6 33.6 199.6
12.1 304.3 47.0 304.2
18.2 421.2 40.2 431.0
24.3 508.7 69.2 541.8
30.4 587.6 52.0 636.4
42.6 769.8 83.0 778.2
79.2 987.7 122.0 913.2
106.7 902.3 150.1 848.7
137.2 691.2 114.1 715.2
167.6 543.3 86.16 571.0
228.6 366.7 101.2 333.1

LOCAL IMPLEMENTATION

On the various UNIX networks at IGPP, plotxy is an executable command made available through one of the standard paths like /usr/local/bin. The normal version is the PostScript model, which normally creates the file mypost which may be sent to a printer, or to the screen via the utility pageview, which opens a window and plots the file in it.

POSTSCRIPT ANNEX

Plotxy running in PostScript mode prints a message informing you of the PostScript output; then the default output file is named mypost. Because PostScript files are ASCII, you may edit them to produce special effects. To help you, plotxy inserts comment lines to indicate which piece of the graph is currently being plotted. Special commands that only work in the PostScript mode are weight and fill. weight command allows different line thickness to be specified.

To fill a region with a solid color, use the fill command. Series are drawn in the order they are read, and notes are last. This command works with smooth, but not perhaps as one might like, because only y as a function of x is smooth, and the region is completed by joining the first and last points. To draw a filled rounded area (like an ellipse), one should define the boundary very densely and turn smooth off. Dashed curves will not fill properly. Because of PostScript limitations, bounding curves for fill should comprise fewer than 1001 points.

 For content questions please contact: Lisa Tauxe Scripps Institution of Oceanography La Jolla, CA 92093-0220, USA Phone: (+1.619) 534-6084 Fax: (+1.619) 534-0784
NOAA>NESDIS>NCEI>Geomagnetism