CHAPTER 6 PLOT PACKAGE SUBROUTINES
This chapter describes the standard MIIPS plotting
subroutines available to FORTRAN programmers on OpenVMS VAX. In
the subroutine descriptions that follow, the letters "C" and "R"
indicate where the argument is to be defined. "C" means that the
value is provided in the subroutine call, and "R" means that the
value is returned by the subroutine. For practically all
applications, and for both beginning and advanced programmers
alike, the most useful subroutine will be XYPLOT. In order to
link new programs that contain calls to the MIIPS plotting
package subroutines, one should use the P1LINK command given in
Chapter 2 of the this volume. Additional documentation can also
be found in each subroutine located on [MIIPS.PLOT]
Page 2
6.1 HIGH LEVEL MODULES
6.1.1 XYPLOT SUBROUTINE
This subroutine is a generalized plotting routine which can
plot several plots and/or histograms on one or more plot devices
at the same time with a variety of colors, symbols, vector line
styles, pen widths, and filling styles. The scaling of the axes
can be done automatically or controlled by the user through the
calling program or interactivley by responding to prompts.
Linear and antilog annotation of the axes is possible.
Additional axis annotation in different units can be added on the
right and upper sides of the plot. By turning on the cursor one
can read back the physical values from the plot, where the values
are put into a COMMON block for use by the calling program. The
user can replot subsections of the plot defined by the cursor and
modify the values of the data through simple arithmetic
operations. Text, including Greek characters, can be added
interactively or through the calling program.
In addition to the SUBROUTINE XYPLOT, there is also a
command XYPLOT, which when entered at the terminal, will prompt
the user for a data file, and other information to make a plot.
This convenient facility is described in Volume 1, Chapter 15.
Call:
CALL XYPLOT(XARRAY,YARRAY,SIZE,NPLOTS,NPOINTS,LINVECT,INC,
LINTYPE,NSYMBOL,INVERT,COLOR,INTERACT,CROSSHAIRS,XLABEL,
YLABEL,TITLE,DEVICES,ADDENDA)
Where:
NAME I/O TYPE DESCRIPTION
XARRAY C R4 is the array holding the data for the X
postions of each point for each plot. A
linear scaling of the axes is automatically
done from the range of values of the first
plot in the array, provided that
XARRAY(SIZE-3) equals 0. If XARRAY(SIZE-3)
equals -1, an antilog scaling of the axes
is automatically done. The linear scaling
can be manually controlled from the calling
program by filling the last 4 locations
with the axis length, number of intervals,
starting physical value, and physical
increment per interval. The antilog
scaling can be manually controlled from the
calling program by filling the last 4
locations with the axis length, number of
decades, starting physical value, and zero.
Note that the fractional parts of the
decades, and starting value are antilogs.
Alternately, the scaling can be done
interactively if CROSSHAIRS is .TRUE. and
I is typed. It is sometimes convenient to
Page 3
have points in the array which should not
be plotted. This can be done by setting
their value equal to '7FFFFFFF'X. In order
to draw error bars or residual vectors, the
data for the locations of the ends of the
lines are arranged in pairs, stored in
array locations which differ by one in the
second index in XARRAY and YARRAY.
Alternately, if NSYMBOL contains a flag
value, i.e., 100 added to the previous
value, then instead of pairs of end-point
locations, one can use a central location
and deviation. For example, for a vertical
errorbar located at (1.0,2.0) with a
deviation of 0.1 we could have
XARRAY(1,1)=1.0, YARRAY(1,1)=2.0,
XARRAY(1,2)=1.0, YARRAY(1,2)=0.1. Note
that XARRAY(1,2) can either repeat the
value for XARRAY(1,1) or be set equal to
zero. The increment mode can only be used
for drawing errorbars, not residual
vectors.
YARRAY C R4 is like XARRAY but for the Y positions.
SIZE C I4 is one of the dimensions of XARRAY and
YARRAY. It should at present be at least 4
larger than the maximum number of points in
any plot.
NPLOTS C I4 is the number of plots to be simultaneously
produced and one the dimensions of XARRAY
and YARRAY. If error bars are to be
produced, NPLOTS must be increased by 2;
the values for the end points of the error
bars should be placed in XARRAY and YARRAY.
NPOINTS C I4 is an array containing the number of data
points for each pair of arrays for each
plot.
LINVECT C I4 is an array giving the vector type (solid,
dashed, etc.) for each plot. The numbers
range from 0 to 4 for the VT100 and the
Visual 550, 0 to 7 for the GraphOn, and
from 0 to 15 for the Lasergrafix. See
[MIIPS.PLOT]VECTMODE.FOR for some examples.
One can optionally control the pen width
(only on the Lasergrafix and Apple Laser
Writer) by including the width in
thousandths of an inch in the second byte
of LINVECT. If the pen width number is not
present, a default pen width (equal to 6
pixels (20/1000 inch) on the Apple and 7
pixels on the Lasergrafix) is selected.
Page 4
INC C I4 is an array containing the increment to be
used in stepping through XARRAY and YARRAY
when plotting
LINTYPE C I4 is an array controlling the type of line to
be drawn through the data points. The
magnitude of LINTYPE controls the frequency
of plotted symbols: e.g. if LINTYPE
equals 4 a special symbol drawn at every
4'th data point. If LINTYPE is zero, no
symbols are plotted. If LINTYPE is
positive, a straight line connects the data
points. If LINTYPE is negative, no
connecting lines are drawn; only the
symbols are plotted. If LINTYPE = 997,
error bars are drawn; if LINTYPE = 998, a
histogram is drawn with the bars stacked
vertically if multiple plots are made; and
if LINTYPE = 999, a histogram is drawn with
the bars placed next to each other if
multiple plots are made.
NSYMBOL C I4 is an array giving the symbol for each
plot. Values from 0 to 13 are allowed. If
a character is to be plotted instead of a
symbol, the ASCII code of the character
should be placed in the second byte of
NSYMBOL. If a histogram is to be drawn,
the value in the first byte gives the the
filling style (on the Visual 550 and the
Lasergrafix 1200). If error bars are to be
drawn, the value in the first byte gives
the style of the end of the error bar. A
zero gives the usual short tick at that
end; a +1 gives nothing at that end; a +2
gives an arrow- head at that end. The
value in the third byte specifies the
symbol height in hundredths of an inch. If
the value is not present, a default of 0.14
inch is chosen.
INVERT C LOG2 is an array controling the inversion of
data plotted in the x and y directions,
respectively.
COLOR C I4 is an array containing the color for each
plot. A value of zero causes that
particular plot not to be drawn. Some
examples of useful colors (24-bit) are:
Azure = 8943581
Blue = 255
Brown = 811840, 10061960
Cyan = 65535
Page 5
Gray = 1118481, 2236962, 3355443, 4473924
5592405, 6710886, 7829367, 8947848
10066329, 11184810, 12303291, 13421772
14540253, 15658734, 16777215
Green = 65280
Magenta = 16711935
Olive = 4465152, 7820561
Orange = 14518272, 16742144
Raspberry = 5570560, 6689041, 7798835,
7803153
8912947, 10031377
Red = 16711680
Rust = 11149824
Tan = 10044433
Violet = 1170756, 4456499
Yellow = 16776960
INTERACT C LOG2 is a logical variable controlling whether
the user will be forced to provide plotting
parameters. If .TRUE. the user is asked
for whether the axes are to be inverted,
the lowest physical value and increment,
the axes' labels, the title, and the plot
device. In general this should be set to
.FALSE. and interaction done as described
below.
CROSSHAIRS C LOG2 is a logical variable controlling whether
the crosshairs can be turned on and used to
read data values from the plot and redo the
plot. If .TRUE., then the following is
true:
Typing (not entering) A will turn on the
crosshairs and by pressing the <CR> at
chosen X limits, the mean Y value will be
calculated for each plot.
Typing a allows the user to enter
annotation at the location of the
crosshairs with the color most recently
selected. CNTRL I toggles to the Greek
alphabet and special symbols and back to
English, CNTRL H gives a backspace, and
CNTRL J toggles to subscript, superscript,
and back to normal. Refer to [MIIPS.PLOT]
SYMGENGR.MAR for the locations of the Greek
characters and special symbols on the
keyboard.
Typing B and defining a box with the
crosshairs will replot with user defined
scaling.
Typing C turns on the crosshairs, pressing
the <CR> prints the values at that location
and puts the values in a common block,
typing - deletes the last pair of values
from the common block, and typing Q turns
Page 6
off the crosshairs.
Typing c allows the user to be prompted for
the color.
Typing F allows the user to alter the
scaling factor for the current plot
device(s).
Typing f allows the user to change the fill
style for each plot.
Typing I allows the user to be prompted for
several of the plotting parameters before a
replot is done. This command is typically
used when preparing a plot for publication.
The following operations are available:
1) Inverting the X axis and/or Y axis
2) Labeling the X and Y axes in the
following ways: Linear automatic, Linear
manual, Antilog automatic, Antilog manual
(antilog refers to the fact that the
labeling is the antilog of the plotted
values which are logs)
a) In the Linear manual mode one can
specify for the X and Y axes, the lowest
labeled physical value, the physical
value/interval, and the number of intervals
(coded as nn.llrr where nn is the integer
part, .ll represents the left (or bottom)
fractional part, and .rr represents the
right (or top) fractional part of an
interval).
b) In the Antilog manual mode one can
specify for the X and Y axes, the lowest
displayed tick mark (coded as log.antilog
where log is the integer part of the
plotted value (which is a log), and antilog
represents the first displayed tick mark of
that decade (which is an antilog)). The
antilog of the physical value at the first
tick mark may or may not be printed byu the
program. One can also specify the number
of displayed decades (coded as n.antilog
where n is the integer part of the number
of decades, and antilog represents the
rightmost displayed tick mark of an
additional decade. For example, if one
enters -1.5 for the lowest value and 3.2
for the number of decades, then the first
tick mark will be at X=0.5 (log = -0.301 =
-1 + 0.699) and the last tick mark will be
at X=200 (log = 2.301). Note that
fractional parts of .0 and .1 behave the
same way.
Note: If the original plot was linear,
then the log of the data should be taken
first (with the L command) for the antilog
labeling to make sense.
Page 7
3) Specifying symbol heights
4) Specifying labels for the X and Y axes
5) Specifying a title
6) Specifying one or more print devices
Typing L allows the user to take the log.
Typing l allows the user to take the
natural log.
Typing M allows the user to modify the X
and Y values by adding increments and
adjusting by scaling factors.
Typing O redoes the original plot. If keys
X, x, Y, or y were pressed, additional axes
will be plotted.
Typing P allows the user to take powers.
Typing p allows the user to determine the
color of each plot.
Typing o redoes the original plot. If keys
X, x, Y, or y were pressed, that
information is cancelled.
Typing Q will return.
Typing R will turn on the crosshairs and by
pressing the <CR> at chosen X limits,
replotting with automatic scaling will be
done.
Typing S allows the user to specify the
style of vector
Typing V allows cursor input for drawing a
solid vector of the color and line style
most recently selected.
Typing v allows the user to be prompted for
the starting and ending physical values of
a vector.
Typing X or Y allows plotting additional
linearly scaled axes in different units.
Typing x or y allows plotting additional
antilog scaled axes in different units.
XLABEL C CHAR is the label to be displayed along the x
axis. Control I toggles between the Greek
and English alphabets; control J toggles
between sub- scripts, superscripts, and
normal type; and control H will insert a
backspace.
YLABEL C CHAR is the label to be displayed along the y
axis.
TITLE C CHAR is the title to be displayed in the upper
right of the plot.
DEVICES C CHAR is the string of plotting devices. See
subroutine PLOTDEVICES for the allowed
values. If it is blank in the call, the
user is prompted for the devices. The
first plot device given is the one which
Page 8
will be used for readback of cursor
coordinates.
ADDENDA C LOG2 is an optional argument which if .TRUE.
will prevent a call to PLOT with IPEN=999,
thus allowing further plotting and
annotation by the calling program. The
calling program should call PLOT with
IPEN=999 when all additional plotting is
completed. All coordinates for annotation
are measured in inches from the lower left
corner of the plot.
Because XYPLOT is recommended for most plotting
applications, an example program is presented below for the
programmer's convenience.
PROGRAM XYPLOTDEM
C
C This program demonstrates the useage of XYPLOT.FOR for
C graphing three curves at the same time.
C
PARAMETER (MAXPLOTSIZE=2000,MAXNPLOTS=5)
CHARACTER*10 DEVICES
CHARACTER*50 XLABEL,YLABEL,TITLE
DIMENSION XARRAY(MAXPLOTSIZE,MAXNPLOTS),
1YARRAY(MAXPLOTSIZE,MAXNPLOTS)
INTEGER COLOR(MAXNPLOTS)
INTEGER SIZE,NPLOTPOINTS(MAXNPLOTS),LINVECT(MAXNPLOTS),
1INC(MAXNPLOTS),LINTYPE(MAXNPLOTS),NSYMBOL(MAXNPLOTS)
LOGICAL INVERT(2),CROSSHAIRS,INTERACT
C
BYTE BCNTH,BCNTI,BCNTJ ! Optional control characters for
! text
CHARACTER*1 CNTH,CNTI,CNTJ
EQUIVALENCE (BCNTH,CNTH),(BCNTI,CNTI),(BCNTJ,CNTJ)
C
BCNTH='08'X ! Backspace
BCNTI='09'X ! English, Greek
BCNTJ='0A'X ! Sub- and superscript
C
SIZE=MAXPLOTSIZE
NPLOTS=3
NPLOTPOINTS(1)=200
NPLOTPOINTS(2)=100
NPLOTPOINTS(3)=50
LINVECT(1)=0
LINVECT(2)=1+43*256 ! Controls the pen width
LINVECT(3)=0
INC(1)=1
INC(2)=1
INC(3)=1
LINTYPE(1)=0
LINTYPE(2)=0
Page 9
LINTYPE(3)=-1 ! Symbols with no connecting lines
NSYMBOL(1)=0
NSYMBOL(2)=0
NSYMBOL(3)=3 ! + symbol
INVERT(1)=.FALSE.
INVERT(2)=.FALSE.
COLOR(1)=16776960 ! Yellow
COLOR(2)=16711935 ! Magenta
COLOR(3)=8943581 ! Tan
CROSSHAIRS=.TRUE.
INTERACT=.FALSE.
XLABEL='ANGLE (degrees)'
YLABEL='F'//CNTJ//'1,2,3'//CNTJ//CNTJ//'('//CNTI//'t'
1//CNTI//')'
TITLE='SAMPLE'
DEVICES=' ' ! User will be prompted for the devices. A
! simpler method than this is to put ' '
! in the argument list.
XARRAY(SIZE-3,1)=0.0 ! Initialization
YARRAY(SIZE-3,1)=0.0
DO I=1,NPLOTPOINTS(1)
XARRAY(I,1)=(I-1)*360.0/NPLOTPOINTS(1)
YARRAY(I,1)=SIND(2.0*XARRAY(I,1))
END DO
DO I=1,NPLOTPOINTS(2)
XARRAY(I,2)=(I-1)*360.0/NPLOTPOINTS(2)
YARRAY(I,2)=0.5*SIND(XARRAY(I,2))
END DO
DO I=1,NPLOTPOINTS(3)
XARRAY(I,3)=(I-1)*360.0/NPLOTPOINTS(3)
YARRAY(I,3)=0.75*COSD(XARRAY(I,3))
END DO
CALL XYPLOT(XARRAY,YARRAY,SIZE,NPLOTS,NPLOTPOINTS,LINVECT,
1INC,LINTYPE,NSYMBOL,INVERT,COLOR,INTERACT,CROSSHAIRS,
2XLABEL,YLABEL,TITLE,DEVICES)
CALL RESETTEK ! Erases the screen and returns to transparent
! mode
END
Page 10
6.1.2 CONTOURPLOT SUBROUTINE
This subroutine produces contour plots of the array ARRAY.
Contour plots can produced by several different methods; 1) line
contours of specified intensity levels, 2) symbol contours of
specified intensities, 3) line contours spaced equidistant in
intensity, 4) scanning. Output can be sent to any plot device in
the plot package. Annotation can be added as in XYPLOT. See
[MIIPS.FOR]ACTPLT.FOR for an example of the use of CONTOURPLOT.
Call:
CALL CONTOURPLOT(ARRAY,NCOLS,NROWS,MAPSCOL,MAPSROW,
1KIND,C,XYOFF,XYSCALE,CONTOUR,LINVECT,NSYMBOL,COLOR,
2NCONTOURS,DELV,HEIGHT,INTERACT,CROSSHAIRS,DEVICES,ADDENDA)
Where:
NAME I/O TYPE DESCRIPTION
ARRAY C R4 is the array holding the z values
corresponding to each x,y pair. The x and
y values are assumed to start at 1,1 in the
lower left corner and increment by 1.first
NCOLS C I4 is the x dimension of ARRAY.
NROWS C I4 is the y dimension of ARRAY.
MAPSCOL C I4 is the starting column in the full array of
which ARRAY is a subset. This is used for
readback of coordinates.
MAPSROW C I4 is the starting row in the full array.
KIND C I4 is the kind of contour plot: 1) contour
follower, 2) symbol plotter, 3) equidistant
contours, 4) line scanner
LEVELS C R4 is an array containing the intensity levles
for the contours.
XYOFF C I4 is an array for the x and y offsets, in
inches, to the lower feft corner of the
plot.
XYSCALE C I4 is an array for the x and y scale factors
in units of inches per pixel.
CONTOUR C C1 is a character variable which determintes
whether every other contour is dashed, 'D',
or whether the user determines the dashing,
'S'.
LINVECT C I4 is an array giving the vector type (solid,
dashed, etc.) for each plot. The numbers
Page 11
range from 0 to 4 for the VT100 and Visual
550, from 0 to 7 for the GraphOn, and from
0 to 15 for the Lasergrafix. See
[MIIPS.PLOT]VECTMODE.FOR for some examples
of the vector line stles. One can
optionally control the pen width (only on
the Lasergrafix and Apple Laser Writer) by
including the width in thousandths of an
inch in the second byte of LINVECT. If the
pen width number is not present, a default
pen width (equal to 6 pixels on the Apple
and 7 pixels on the Lasergrafix) is
selected.
NSYMBOL C I4 is the symbol type for KIND=2
COLOR C I4 is an array containing the color for each
contour. See section 6.1.1 or
[MIIPS.PLOT]COLORMODE.FOR for some examples
of the colors.
NLEVELS C I4 is the dimension of LEVELS.
DELV C R4 is the intensity range of a symbol when
KIND = 2.
HEIGHT C R4 is the height of a symbol when KIND = 2.
INTERACT C LOG is a variable which allows the user to be
prompted for plotting parameters. If
.TRUE. the user is asked for the
penwidths, dashing, and colors.
CROSSHAIRS C LOG is a logical variable which when .TRUE.
allows
Typing a allows the user to enter
annotation at the location of the
crosshairs with the color most recently
selected. CNTRL I toggles to the Greek
alphabet and special symbols and back to
English, CNTRL H gives a backspace, and
CNTRL J toggles to subscript, superscript,
and back to normal. Refer to
[MIIPS.PLOT]SYMGENGR.MAR for the locations
of the Greek characters and special symbols
on the keyboard.
Typing c allows the user to be prompted for
the color.
Typing C reads back a coordinate value.
Typing F constructs a frame around the
plot.
Typing P allows the user to plot a point
from the physical coordinates.
Page 12
Typing Q will return.
Typing V allows cursor input for drawing a
solid vector of the color most recently
selected.
DEVICES C CHAR is the string of plotting devices. See
subroutine PLOTDEVICES for the allowed
values. If it is blank in the call, the
user is prompted for the devices.
ADDENDA C LOG is an optional argument which if .TRUE.
will prevent a call to PLOT with IPEN=999,
thus allowing further plotting and
annotation by the calling program. The
calling program should call PLOT with
IPEN=999 when all additional plotting is
completed. All coordinates for annotation
are measured in inches from the lower left
corner of the plot.
Page 13
6.1.3 MESHPLOT SUBROUTINE
This subroutine plots a surface in the form of a projected
mesh plot on any plot device in the plot package. Annotation can
be added as in XYPLOT. See [MIIPS.FOR]SURFPLOT.FOR for an
example of the use of MESHPLOT.
Call:
CALL MESHPLOT(ARRAY,M,N,REFP,VDIR,SCRD,SCRZ,COLOR,LINVECT,
1CROSSHAIRS,DEVICES,ADDENDA)
Where:
NAME I/O TYPE DESCRIPTION
ARRAY C R4 is the array holding the z values
corresponding to each x,y pair. The x
values are also included in the first row
between columns 2 and N and the y values
are included in the first column between
rows 2 and N. Position 1,1 is not used.
M C I4 is the x dimension of ARRAY. This is 1
larger than the number of x values which
will be plotted.
N C I4 is the y dimension of ARRAY. This is 1
larger than the number of y values which
will be plotted.
REFP C R4 is an array giving the reference point for
where the viewer is located.
VDIR C R4 is an array giving a vector pointing in the
direction of view.
SCRD C R4 is the perpendicular distance of the screen
from the reference point.
SCRZ C R4 is the screen width.
COLOR C I4 An array giving the color for the top and
bottom of the mesh plot. A value of 0
causes that particular plot not to be
drawn. See section 6.1.1 or
[MIIPS.PLOT]COLORMODE.FOR for some examples
of the colors.
LINVECT C I4 is an array giving the vector type (solid,
dashed, etc.) for the top and bottom of the
mesh plot. The numbers range from 0 to 4
for the VT100 and Vishual 550, from 0 to 7
for the GraphOn, and from 0 to 15 for the
Lasergrafix. See [MIIPS.PLOT]VECTMODE for
some examples of the vector sttyles. One
Page 14
can optionally control the pen width (only
on the Lasergrafix) by including a number
from 1 to 31 in the second byte of LINVECT.
If the pen width number is not present, a
default pen width (equal to 7) is selected.
CROSSHAIRS C LOG is a logical variable which when .TRUE.
allows the user to modify the plot in the
following way:
Typing a allows the user to enter
annotation at the location of the
crosshairs with the color most recently
selected. CNTRL I toggles to the Greek
alphabet and special symbols and back to
English, CNTRL H gives a backspace, and
CNTRL J toggles to subscript, superscript,
and back to normal. Refer to
[MIIPS.PLOT]SYMGENGR.MAR for the locations
of the Greek characters and special symbols
on the keyboard.
Typing c allows the user to be prompted for
the color.
Typing O redoes the original plot.
Typing Q will return.
Typing V allows cursor input for drawing a
solid vector of the color and line style
most recently selected.
DEVICES C CHAR is the string of plotting devices. See
subroutine PLOTDEVICES for the allowed
values. If it is blank in the call, the
user is prompted for the devices.
ADDENDA C LOG is an optional argument which if .TRUE.
will prevent a call to PLOT with IPEN=999,
thus allowing further plotting and
annotation by the calling program. The
calling program should call PLOT with
IPEN=999 when all additional plotting is
completed. All coordinates for annotation
are measured in inches from the lower left
corner of the plot.
Page 15
6.2 LOW LEVEL MODULES
6.2.1 PLOTDEVICES SUBROUTINE
The PLOTDEVICES subroutine selects one or more plotdevices.
If the call is made with the first array element blank, the user
will be prompted for the plotdevice or plotdevices. The call to
this subroutine should be followed by a call to PLOTDEVICES2 for
proper initialization.
Call:
CALL PLOTDEVICES(DEVICES)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
3
DEVICES C CHAR3 selects the plot device. It is an array of
10 elements.
If DEVICES(1:1) equals a blank the user is
prompted for one or more plot devices.
If DEVICES(I:I) equals G the plot will
appear on a VT100 or Visual 550 graphics
terminal.
If DEVICES(I:I) equals G1 the plot will
appear on a GraphOn graphics terminal.
If DEVICES(I:I) equals G2 the plot will
appear on a Codonics graphics terminal.
If DEVICES(I:I) equals G3 the plot will
appear on a MicroTerm graphics terminal.
If DEVICES(I:I) equals F the plot will go
to a plot file (the file can be plotted
later using the $PLOT command; see Volume
1, Chapter 15).
If DEVICES(I:I) equals R the plot will
appear on a Ramtek.
If DEVICES(I:I) equals T the plot will
appear on a Tektronix 4662 Plotter.
If DEVICES(I:I) equals GR the plot will
appear on a Grinnell. The screen is erased
after PLOTDEVICES2 is called.
If DEVICES(I:I) equals -GR the plot will
appear on a Grinnell but the screen is not
erased after the call to PLOTDEVICES2.
Page 16
If DEVICES(I:I) equals H the plot will
appear on a Houston (not yet incorporated).
If DEVICES(I:I) equals L the plot will
appear on a Lasergrafix.
If DEVICES(I:I) equals A0, or A1, etc., the
plot will appear on one of the Apple Laser
Writers.
If DEVICES(I:I) equals TR the plot will
appear on a Trapix. The screen is erased
after PLOTDEVICES2 is called.
If DEVICES(I:I) equals -TR the plot will
appear on a Trapix but the screen is not
erased after the call to PLOTDEVICES2.
Page 17
6.2.2 PLOTDEVICES2 SUBROUTINE
The PLOTDEVICES2 subroutine initializes one or more
plotdevices. The call to this subroutine should be preceeded by
a call to PLOTDEVICES.
Call:
CALL PLOTDEVICES2(DEVICES)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
3
DEVICES C CHAR3 selects the plot device. It is an array of
10 elements set up in the call to
PLOTDEVICES.
Page 18
6.2.3 PLTDEV SUBROUTINE
The PLTDEV subroutine is a lower level routine which obtains
a channel for a plotting device and initializes it in the vector
mode. This is normally called by PLOTDEVICES2 and is of no
concern to the user. However, PLOTDEVICES and PLOTDEVICES2 may
be bypassed by calling PLTDEV directly; this was the proper way
to initialize in previous versions of this plotting package. In
this case, a plot device is identified by a number (described
below). This subroutine generally allows use of only one device
at a time (except the case of a graphics terminal and a plot
file). For future development this subroutine should not be
called directly; call PLOTDEVDEVICES followed by PLOTDEVICES2.
Call:
CALL PLTDEV(NDEV)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
NDEV C I4 selects the plot device.
If NDEV equals 1 the plot will appear on a
VT100 or Visual 550 graphics terminal. The
screen is initially erased.
If NDEV equals 101 the plot will appear on
a GraphOn graphics terminal. The screen is
initially erased.
If NDEV equals 201 the plot will appear on
a Codonics graphics terminal. The screen
is initially erased.
If NDEV equals 301 the plot will appear on
a MicroTerm graphics terminal. The screen
is initially erased.
If NDEV equals 401 the plot will appear on
a VersaTerm graphics terminal emulator.
The screen is initially erased.
If NDEV equals 2 the plot will go to a plot
file (the file can be plotted later using
the $PLOT command).
If NDEV equals 3 the plot will appear on a
Ramtek.
If NDEV equals 4 the plot will appear on a
VT100 or Visual 550 graphics terminal and
simultaneously will go to a plot file.
This is retained only for compatibility.
Page 19
NDEV equals 5 is currently not used
NDEV equals 6 is currently not used.
If NDEV equals 7 the plot will appear on a
Tektronix 4662 Plotter.
If NDEV equals 8 the plot will appear on a
Grinnell. The screen is initially erased.
If NDEV=-8, the Grinnell is assigned but
the screen is not erased.
If NDEV equals 9 the plot will appear on a
Houston (not yet incorporated).
If NDEV equals 10 the plot will appear on a
Lasergrafix.
If NDEV equals 11, or 111, or 211, etc.,
the plot will appear on one of the Apple
Laser Writers (after the VECT.RPL file is
sent).
If NDEV equals 12 the plot will appear on a
Trapix. The screen is initially erased.
If NDEV=-12, the Trapix is assigned but the
screen is not erased.
Page 20
6.2.4 PLOT SUBROUTINE
The PLOT subroutine is used primarily to move the pen in a
straight line.
Call:
CALL PLOT(X,Y,IPEN)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
X,Y C R4 are the X,Y coordinates, in inches from the
current origin, of the terminal position to
which the pen will be moved. An origin may
be established anywhere on (or off) the
plotting surface, by specifying a negative
value of IPEN.
IPEN C I4 is a signed integer which controls pen
up/down status and origin definition.
IF IPEN=1, the plot device is placed in the
point plot mode.
If IPEN=2, the pen is down during movement,
drawing a visible line (or a dot at the
endpoint if in the point plot mode).
If IPEN=3, the pen is up during movement.
If IPEN= -2 or -3, a new origin is defined
at the terminal position after the movement
is completed as if IPEN were positive. The
logical X,Y coordinates of the new pen
position are set as zero, so that that
position becomes the reference point for
subsequent pen movements. Succeeding calls
with IPEN= -2 or -3 will again define a new
origin, but the changes are made in a
relative sense, since the new origin will
equal the value in the call plus the
previous origin.
If IPEN=4, the plot device is returned to
the transparent mode.
If IPEN=5, the value of line style (solid,
dashed, etc.) in the COMMON block
PLOT$VECTOR is sent to the plot device.
If IPEN=6, the value of the color in the
COMMON block PLOT$COLOR is sent to the plot
device.
Page 21
If IPEN=7, the bell on the plot device (if
such exists) is rung.
If IPEN=8, the value of the data level
(dots on, dots off, etc.) in the COMMON
block PLOT$DATALEVEL is sent to the plot
device.
If IPEN=9, the plot device is placed in the
rectilinear graphics mode.
If IPEN=10, the plot device is placed in
the alphagraphics mode.
If IPEN=11, the value of the fill style in
the COMMON block PLOT$FILLSTYLE is sent to
the plot device.
If IPEN=12, the value of the pen width in
the COMMON block PLOT$PENWIDTH is sent to
the plot device.
If IPEN=999, the end of the current plot is
signalled. All plotting programs should
conclude with CALL PLOT(X,Y,999).
If IPEN=9999, the current plot file is
closed. (An end-of-file mark is created.)
Page 22
6.2.5 FACTOR SUBROUTINE
The FACTOR subroutine enables the user to enlarge or reduce
the size of the entire plot.
Call:
CALL FACTOR(FACT)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
FACT C R4 is the ratio of the new plot size to the
normal plot size. For example, if
FACT=2.0, all subsequent pen movements will
be twice their normal size. When FACT is
reset to 1.0, all plotting returns to
normal size. A saving in computer and
plotter time is made possible during
debugging by calling FACTOR with a value
less than 1.0, so the entire plot output
will be reduced in size.
Page 23
6.2.6 WHERE SUBROUTINE
The WHERE subroutine provides cursor functions for the
interactive plot devices (currently a graphics terminal, a
Ramtek, and a Grinnell). When WHERE is called the program waits
until the user has positioned the crosshairs (on graphics
terminals), or cursor (on Ramtek or Grinnell), and has typed a
character at the terminal from which the program is being run.
Call:
CALL WHERE(XNOW,YNOW,ICHA)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
XNOW R R4 is the X-coordinate (in inches) of the
crosshairs or cursor from the lower left
hand corner of the screen, independent of
plot origin and scaling.
YNOW R R4 is similar to XNOW, but is the
Y-coordinate.
ICHA R I4 is the ASCII code of the character which
was typed at the keyboard.
Page 24
6.2.7 SYMBOL SUBROUTINE
The SYMBOL subroutine produces plot annotation at any angle
and in practically any size. There are two SYMBOL call formats:
(1) the "standard" call, which can be used to draw text such as
titles, captions and legends; and (2) the "special" call, which
is used to draw special centered symbols such as a box, octagon,
triangle etc., for plotting data points.
The standard characters that are drawn by SYMBOL include the
letters A-Z (upper and lower case), digits 0-9 and most special
keyboard characters such as "(". Both forms of SYMBOL call have
six arguments. The "standard" call is:
CALL SYMBOL(X,Y,HEIGHT,TEXT,ANGLE,NCHAR)
where:
NAME I/O TYPE DESCRIPTON
X,Y C R4 are the coordinates in inches of the lower
left hand corner (before character
rotation) of the first character to be
produced. The pen is up while moving to
this point. Annotation may be continued
from the position following that at which
the last annotation ended. Continuation
occurs when X and/or Y equals 999.0.
HEIGHT C R4 is the height, in inches, of the character
to be plotted. Characters are formed with
a width/height ratio of about 0.825.
TEXT C BYTE is the text to be used as annotation. The
characters must be left-justified and
contiguous in a single variable or an
array. The text must be right-justified in
TEXT if a single character is desired and
NCHAR=0. Control/H produces a backspace
(for overstriking), Control/I toggles
between the Greek and Engilsh alphabets,
and Control/J toggles between subscript,
superscript,and normal.
ANGLE C R4 is the angle in degrees from the X-axis at
which the annotation is to be plotted. If
ANGLE=0 the character(s) will be plotted
right side up and parallel to the X-axis.
NCHAR C I4 is the number of characters to be plotted
from TEXT. If NCHAR>0 the data must be
left justified in the first location of
TEXT. If NCHAR=0 one symbol is produced,
using a single character which is right
justified in TEXT.
Page 25
The "special" call is:
CALL SYMBOL(X,Y,HEIGHT,CHAR,ANGLE,IPEN)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
CHAR C I4 is an integer in the range 0-13 specifying
a special symbol to be plotted. A plot of
the special symbols can be obtained by
running SYMBOLS.EXE.
IPEN C I4 is an integer which determines whether the
pen is up or down during the move to X,Y.
If IPEN=-1, the pen is up.
If IPEN=-2, the pen is down.
ANGLE should be 0.0.
The special symbols may also be produced in the standard
call by toggling to the Greek alphabet and using numbers 0
through 9 and Shift/0 though 3.
Page 26
6.2.8 NUMBER SUBROUTINE
The NUMBER subroutine converts a real variable to a fixed
decimal number and plots the result.
Call:
CALL NUMBER(X,Y,HEIGHT,FPN,ANGLE,NDEC)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
X,Y C R4 are the coordinates in inches of the lower
left hand corner (before character
rotation) of the first character to be
produced. The pen is up while moving to
this point.
HEIGHT C R4 is the height, in inches, of the characters
to be plotted. Each number has a width to
height ratio of 0.59 if the space between
numbers is not included. If the space is
included, the ratio is 0.836.
FPN C R4 is the floating point number to be plotted.
ANGLE C R4 is the angle in degrees from the x axis at
which the number is to be plotted. If
ANGLE=0 the number will be plotted right
side up and parallel to the X-axis.
NDEC C I4 controls the precision of the conversion of
the number FPN.
If NDEC is greater than 0, it specifies the
number of digits to the right of the
decimal point that are to be converted and
plotted.
If NDEC equals 0, the integer portion of
the number and a decimal point are plotted.
If NDEC equals -1 only the integer portion
of the number is plotted.
If NDEC is less than -1, ABS(NDEC)-1 digits
are truncated from the integer portion of
the number before plotting.
Page 27
6.2.9 SCALE SUBROUTINE
The SCALE subroutine is used to examine the data values in
an array to determine a starting value, either minimum or
maximum, and a scaling factor, positive or negative, such that:
(1) the scale annotation drawn by the AXIS subroutine at each
division will properly represent the range of data values in the
array, and (2) the data points, when plotted by the LINE
subroutine, will fit in a given plotting area. The starting
value and the scaling factor are stored by SCALE at the end of
the data array.
Call:
CALL SCALE(ARRAY,SIZE,NPTS,NINTRVLS,INC)
where:
NAME I/O TYPE DESCRIPTION
ARRAY C/R R4 is the array of data points to be examined.
SIZE C I4 is the dimension of ARRAY. This should be
two larger than the maximum number of data
points because the starting physical value
and the increment are stored in the last
two elements of the array.
AXLEN C R4 is the length of the axis to which the data
is to be scaled. Its value must be greater
than one inch.
NPTS C I4 is the number of data points in the array.
The FORTRAN dimension statement for ARRAY
should specify at least two locations more
than the number of values being scanned, to
allow SCALE to store the computed starting
value and scaling factor at the end of the
array.
NINTRVLS C R4 is the number of tick mark intervals.
Fractional values are allowed.
INC C I4 is an integer whose magnitude is used by
scale as the increment with which to select
the data values to be scanned in the array.
Normally ABS(INC) equals 1 (ie every data
value is examined).
If INC is positive, the selected starting
value approximates a minimum, and the scale
factor is positive.
If INC is negative, the selected starting
value approximates a maximum, and the
scaling factor is negative.
Page 28
6.2.10 AXIS SUBROUTINE
Subroutine AXIS is used to produce a scaled axis: it draws
any length line at any angle, divides it into any number of
segments, (fractional values allowed) annotates the divisions
with appropriate scale values, and labels the axis with a
centered title. When both X and Y axes are needed AXIS is called
separately for each one.
Call:
CALL AXIS(X,Y,TEXT,AXLENGTH,ANGLE,FIRSTV,DELTAV,NINTRVLS,
NINTRVLS__OFF,FLAG,LU)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
X C R4 is the starting x position of the axis
measured in inches assuming that there is
no inversion of the axis.
Y C R4 Like X but in the y direction
TEXT C BYTE is an array containing the title, which
will be centered and placed parallel to the
axis line.
AXLENGTH C R4 is the length of the axis line in inches.
ANGLE C R4 is the angle measured from the horizontal
at which the axis is to be drawn. Normally
this value is 0.0 for the X axis and 90.0
for the Y axis.
FIRSTV C R4 is the starting value which will appear at
the first tick mark on the axis. This
value may be computed by the SCALE
subroutine, or independently specified by
the user.
DELTAV C R4 is the number of data units per inch of
axis. This value may be computed by the
SCALE subroutine, or independently
specified by the user.
NINTRVLS C R4 is the number of intervals per axis length.
If there is to be one tick mark per inch,
then NINTRVLS=AXLEN. Note that NINTRVLS
can have fractional values.
NINTRVLS_OFF C R4 is the fractional offset at the axis
start measured in units of intervals.
FLAG(1) C I2 if +1, the tick marks appear
on the counter-clockwise side of the axis;
Page 29
if -1, they appear on the clockwise side.
FLAG(2) C I2 is like FLAG(1), but for the label.
FLAG(3) C I2 if 0, the numbers by the tick marks are
parallel to the axis; if 1, they are
perpendicular.
FLAG(4) C I2 if 0, the numbers and label are omitted; if
1, they are displayed.
FLAG(5) C I2 if 0, the axes are displayed normally; if
1, they are inverted.
LU C I4 is the logical unit, which if included in
the call will be used, but if omitted is
defaulted.
Page 30
6.2.11 ALOGAXIS SUBROUTINE
Subroutine ALOGAXIS is used to produce an antilog scaled
axis: it draws any length line at any angle, divides it into any
number of decades, or fractions thereof, annotates the divisions
with appropriate scale values, and labels the axis with a
centered title. When both X and Y axes are needed AXIS is called
separately for each one.
Call:
CALL ALOGAXIS(X,Y,TEXT,AXLENGTH,ANGLE,FIRSTDECVAL,DECADES,
FLAG,LU)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
X C R4 is the starting x position of the axis
measured in inches assuming that there is
no inversion of the axis.
Y C R4 Like X but in the y direction
TEXT C BYTE is an array containing the title, which
will be centered and placed parallel to the
axis line.
AXLENGTH C R4 is the length of the axis line in inches.
ANGLE C R4 is the angle measured from the horizontal
at which the axis is to be drawn. Normally
this value is 0.0 for the X axis and 90.0
for the Y axis.
FIRSTDECVAL C R4 is the value corresponding to the beginning
of the axis such that its integer part is
the integer part of the first physical
value (a log) and the log of ten times its
fractional part, is the fractional part of
the first physical value. The antilog of
the first physical value may or may not be
printed by the program.
DECADES C R4 is the number of decade cycles per axis
length starting at the beginning of the
decade corresponding to FIRSTDECVAL such
that its integer part is the integer part
of the number of decades and the log of ten
times its fractional part, is the
fractional part of the number of decades.
For example, if the fractional part is 0.2,
the highest tick mark corresponds to 2
times the previous decade value. Note that
fractional parts of .0 and .1 behave the
same way.
Page 31
FLAG(1) C I2 if +1, the tick marks appear on the
counter-clockwise side of the axis; if -1,
they appear on the clockwise side.
FLAG(2) C I2 is like FLAG(1), but for the label.
FLAG(3) C I2 if 0, the numbers by the tick marks are
parallel to the axis; if 1, they are
perpendicular.
FLAG(4) C I2 if 0, the numbers and label are omitted; if
1, they are displayed.
FLAG(5) C I2 if 0, the axes are displayed normally; if
1, they are inverted.
LU C I4 is the logical unit, which if included in
the call will be used, but if omitted is
defaulted.
Page 32
6.2.12 LINE SUBROUTINE
The LINE subroutine produces a line plot of the pairs of
data values in two arrays (X and Y). LINE computes the page
coordinates of each plotted point according to the data values in
each array and the respective scaling parameters. The data
points may be represented by centered symbols and/or connecting
lines between points. The scaling parameters (see SCALE and
AXIS) must be at the end of each array. These values may be
computed by the SCALE subroutine, or independently specified by
the user.
Call:
CALL LINE(XARRAY,YARRAY,SIZE,NPOINTS,INC,XOFFSET,YOFFSET,
XAXIS,YAXIS,X_INTRVLS,Y_INTRVLS,X_INTRVLS_OFF,Y_INTRVLS_OFF,
LINTYPE,NSYMBL,SYMBLHT,INVERT,LU)
where:
NAME I.O TYPE DESCRIPTION
NAME I.O TYPE DESCRIPTION
XARRAY C R4 is the array containing the X values and
scaling parameters.
YARRAY C R4 is the array containing the Y values and
scaling parameters.
SIZE C I4 is the size of each of the above arrays.
This should be at least two larger than the
maximum number of points in the array.
NPOINTS C I4 is the number of data points in XARRAY and
YARRAY. The number does not include the
extra two locations for the scaling
parameters.
INC C I4 is the increment that the line subroutine
uses to select data from the two arrays
(see the description of this parameter for
the SCALE subroutine).
XOFFSET C R4 is the starting X location of the plot
measured in inches.
YOFFSET C R4 is like XOFFSET but for the Y direction.
XAXIS C R4 is the length of the X-axis in inches.
YAXIS C R4 is the length of the Y-axis in inches.
X_INTRVLS C R4 is the number of intervals per axis length.
If there is to be one tick mark per inch,
then XINTRVLS=XAXIS. Note that X_INTRVLS
can have fractional values.
Page 33
Y_INTRVLS C R4 is like XINTRVLS but in the Y-direction.
X_INTRVLS_OFF C R4 is the fractional offset at the X axis
start measured in units of intervals.
Y_INTRVLS_OFF C R4 is the fractional offset at the Y axis
start
LINTYP C I4 controls the type of line to be drawn
through the data points. The magnitude of
LINTYP controls the frequency of plotted
symbols; e.g., if LINTYP equals 4 a special
symbol is drawn at every 4th data point.
If LINTYP is zero, no symbols are plotted;
only a line is drawn.
If LINTYP is positive, a straight line
connects the data points.
If LINTYP is negative, no connecting lines
are drawn; only the symbols are plotted.
NSYMB C I4 is the number of the plotting symbol to be
centered at each data point. For the
special symbols, the symbol number should
be placed in the first byte location; for
any ASCll symbol, the ASCll code should be
placed in the second byte location.
NSYMBOL has meaning only when LINTYP is non
zero.
SYMBLHT C R4 is the height of a symbol in inches.
INVERT C LOG is a two-dimensional array controlling
whether the X and/or Y plotting directions
are inverted.
LU C I4 is the logical unit, which if included in
the call will be used, but if omitted is
defaulted.
Page 34
6.2.13 HISTOGRAM
6.2.13 HISTOGRAM
This subroutine plots one or more histograms on a plot
device. It is a lower level subroutine called by XYPLOT and does
not produce axis labeling. Either vertically stacked or
horizontally displaced bars can be drawn.
Call:
CALL HISTOGRAM(XARRAY,YARRAY,SIZE,NPLOTS,NPOINTS,LINVECT,
INC,BARTYPE,NFILL,INVERT,COLOR,XOFFSET,YOFFSET,XAXIS,YAXIS,
X__INTERVALS,Y__INTERVALS,X__INTERVALS__OFF,Y__INTERVALS__OFF)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
XARRAY C R4 is the array containing the X positions for
the center of each bar for each histogram.
The X coordinates for any curves to be
plotted by XYPLOT are also in this array.
YARRAY C R4 is the array containing the Y positions
SIZE C I4 is the size of each of the above arrays.
This should be at least two larger than the
maximum number of points in the array.
NPLOTS C I4 is the number of plots to be made,
including curves and histograms, and one of
the dimensions of XARRAY and YARRAY
ISTART C I4 is the starting index in XARRAY and YARRAY
for data to be plotted.
NPOINTS C I4 is the number of data points in the arrays
for each plot including points skipped over
if INC>1 and starting at the index ISTART
and ending at ISTART+NPOINTS
LINVECT C I4 is an array giving the vector type for each
plot.
INC C I4 is an array containing the increment to be
used in stepping through XARRAY and YARRAY
when plotting
BARTYPE C I4 is an array controlling the type of bar to
be drawn for each histogram. If equal to
998, the bars are stacked vertically, and
if equal to 999, they are placed next to
each other in the horizontal direction.
NFILL C I4 is the number for the filling style for
each plot (on a Visual 550 and a
LASERGRAFIX)
Page 35
INVERT C LOG is a two-dimensional array determining
whether the X and/or Y coordinates are to
be inverted.
COLOR C I2 is an array containing the color for each
plot.
XOFFSET C R4 is the starting X location on the plot
device measured in inches.
YOFFSET C R4 is the starting Y location on the plot
device measured in inches.
XAXIS C R4 is the length of the X axis in inches
YAXIS C R4 is the length of the Y axis in inches
X_INTERVALS C R4 is the number of tick mark intervals along
the X axis
Y_INTERVALS C R4 is like XINTERVALS but along the Y axis
X_INTERVALS_OFF C R4 is the fractional offset at the X axis
start measured in units of intervals
Y_INTERVALS_OFF C R4 is the fractional offset at the Y axis
start
Page 36
6.2.14 ERRORBAR
6.2.14 ERRORBAR
This subroutine plots error bars on a plot device. The data
is arranged in pairs of locations for the end points of each bar
where the two end points are stored in array locations which
differ by one in the second index. This subroutine is called by
XYPLOT.
Call:
CALL ERRORBAR(XARRAY,YARRAY,SIZE,NPOINTS,INC,XOFFSET,YOFFSET,
XAXIS,YAXIS,XINTERVALS,NSYMBOL,INVERT)
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
XARRAY C R4 is the array containing the X positions
measured in physical value for the end
points of the error bars.
YARRAY C R4 is the array containing the Y positions
SIZE C I4 is the size of each of the above arrays.
This should be at least two larger than the
maximum number of points in the array.
NPOINTS C I4 is the number of data points in the arrays
for each plot including points skipped over
if INC>1
INC C I4 is an array containing the increment to be
used in stepping through XARRAY and YARRAY
when plotting
XOFFSET C R4 is the starting X location on the plot
device measured in inches.
YOFFSET C R4 is the starting Y location on the plot
device measured in inches.
XAXIS C R4 is the length of the x axis in inches
YAXIS C R4 is the length of the y axis in inches
XINTERVALS C R4 is the number of tick mark intervals along
the X axis
YINTERVALS C R4 is like XINTERVALS but along the Y axis
NSYMBOL C I4 is an array which in the first byte gives
the style for each end of the error bar. A
zero gives the usual short tick at that
end; a +1 gives nothing at that end; a +2
gives an arrowhead at that end.
INVERT C LOG is a two-dimensional array determining
Page 37
whether the X and/or Y coordinates are to
be inverted.
Page 38
6.2.15 RASTER AND RASTEXT SUBROUTINES
Routines RASTER and RASTEXT are used to generate raster plot
files for printing on the Printronix or Versatec
printer/plotters. RASTER generates vectors and RASTEXT generates
text. They are intended for special purpose raster plot
functions only. The Calcomp compatible library should be used
for general purpose plotting.
Because the printers, in particular the Printronix, are
shared devices the usual mode of operation is to generate the
plot on a file on disk which is later submitted to the print
queue with the conventional PRINT command.
In addition, because of the dot matrix operation of the
printers the plot must be generated in a single direction - the
direction of the paper feed. This is done by generating a bit
map within computer memory corresponding to the printer matrix.
However, it is usually not feasible to store the whole bit map in
memory, especially when the length of paper, i.e. the length of
the bit map, is not known in advance. This problem is overcome
by breaking the total bit map into small sections each of which
spans the width of the paper but covers relatively little
distance (say a few inches) along the paper. The complete
sequence of plot operations must be performed for each section in
turn.
Hence, the procedure for generating a raster plot is:
DO for all sections Initialize raster array. In the
case of the Printronix set all bytes to 'C0'X. For
the Versatec, zero all bytes. Make calls to RASTER
and RASTEXT necessary to generate plot. Put special
codes in the raster array. In the case of the
Printronix, '5'X, 'C'X must be inserted in the last
two bytes of each row. Write raster array with one
row per record.
END DO LOOP
Both routines ignore any plot data which lies outside the
section under consideration. So it is possible to pass all plot
functions through the routines each time round the loop.
However, for reasons of efficiency it may be desirable to pretest
all character strings and vectors to see if, in fact, a call to
RASTER or RASTEXT is necessary. To ensure smooth transitions
between sections, any vector or character string which does
intersect the current section should be passed to the generating
routine in its entirety. Otherwise rounding errors may occur at
the section boundaries.
The Printronix line is made up of 132 bytes of six bits
each. This yields a density of 60 dots per inch as opposed to
the density of 72 lines per inch along the page. Note that two
additional bytes per line are required for inserting the '5'X and
'C'X trailing bytes. The Versatec line is made up of 256 bytes
of eight bits each. Dot density on the Versatec is the same in
both directions and equals 200 dots/lines per inch.
Page 39
Raster plot files should be opened with
"FORM='UNFORMATTED'". If "DISPOSE='PRINT'" is used when the file
is closed, it will be queued directly to the Printronix.
Call:
CALL RASTER(PRNTYPE,ARRAY,NBYTES,NLINES,NB1,NL1,IFUNC,
[Function-dependent arguments])
where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
PRNTYPE C CHAR is either "PRINTRONIX" or "VERSATEC".
ARRAY C/R BYTE is the array in which the raster is
generated.
NBYTES C I4 is the number of bytes per line in ARRAY.
NLINES C I4 is the number of lines in ARRAY.
NB1,NL1 C I4 are the logical coordinates of the top left
bit of the current section.
IFUNC C I4 is the operation to be carried out:
1. Draws grid lines - horizontal or
vertical, dashed or full.
2. Plots a set of vectors.
Page 40
Function dependent parameters are:
If IFUNC=1:
IORIENT C I4 is 0 for horizontal orientation, 1 for
vertical.
ICOORD C I4 is the raster coordinate of the line. This
is either a bit number or a line number as
appropriate.
NBON C I4 is the number of bytes written - allows
variable dashing of the line when varied in
conjunction with NBOFF. Must be set to 1
for full line. Note that in the case of
dashed vertical lines, a dash always starts
on the top line of the current section.
The number of lines per section must be
selected carefully in order to give dashed
vertical lines a regular appearance at
section boundaries.
NBOFF C I4 is the number of bytes blank (see the
description of NBON above). Must be set to
0 for a full line.
If IFUNC=2:
VECTORS C I4 is a two-dimensional array containing the
vector coordinates. The first number in
each pair is the coordinate across the
page, the second is the coordinate down the
paper. All points in VECTORS are joined.
NVECT C I4 is the number of vectors in VECTORS (the
number of points minus one).
Page 41
The call for RASTEXT is:
CALL RASTEXT(PRNTYPE,ARRAY,NBYTES,NLINES,NB1,NL1,IB1,IL1,
1STRING,IORIENT,ISIZE)
Where:
PRNTYPE, ARRAY, NBYTES, NLINES, NB1, NL1 are as for RASTER;
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
IB1,IL1 C I4 are the coordinates of the start of the
character string.
STRING C CHAR is the character string to be plotted.
IORIENT C I4 is the orientation of the string:
0. Normal print orientation on paper.
1-3. are rotated 90 degrees in clockwise
direction from the previous orientation.
ISIZE C I4 is the character size (in integer multiples
of matrix size).
Page 42
6.2.16 TCPLOT SUBROUTINE
This subroutine produces a plot on a graphics terminal or on
one of the other on-line devices available in the plot package.
The data is plotted against the index of its array and so is
spaced evenly in the X direction. The data is also scaled to
fill the entire width and height of the plot boundaries. For a
more general plotting routine see Section 6.16, XYPLOT
Subroutine. This subroutine is obsolete and should not be used
for future development. It will eventually be elliminated from
future versions of MIIPS.
Call:
CALL TCPLOT(Z,NPTS,STX,SCX,STY,SCY,XOR,YOR,CHAN,NDEV,DELTA)
Where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
Z C R4 is the array containing the data to be
plotted.
NPTS C I4 is the default number of points to be
plotted from the array if the number is
asked for.
STX R R4 is the starting index of the array, i.e.,
ILO.
SCX R R4 is the scale factor in the X direction;
index per inch.
STY R R4 is the lowest value to be plotted from the
array, i.e., YLO.
SCY R R4 is the scale factor in the Y direction;
value per inch.
XOR R R4 is the origin of the plot on the screen in
the X direction measured in inches.
YOR R R4 same as XOR, but for the Y direction.
CHAN C/R I4 CHAN(1) and CHAN(2) are the starting and
ending indexes of the array Z to be used
for plotting. If either or both are equal
to zero, the indexes are asked for in this
subroutine. CHAN(1) and CHAN(2) are the
same as ILO and IHI, respectively.
NDEV C/R I4 is the number of the plot device (see
Section 6.3). If it equals zero in the
call, it is asked for in this subroutine.
Page 43
DELTA C R4 DELTA(1) and DELTA(2) are the differences
between the index of the array and the
physical value plotted along the abscissa
at the left and right ends. This argument
is optional, but is useful when the
physical value differs from the index and
you wish it to be correctly displayed.
Page 44
6.2.17 PRINTRNX SUBROUTINE
This subroutine plots an array of data on the Printronix,
evenly spaced with respect to its index. No tick marks are drawn
and the data is scaled so as to cover as large an area as
possible on the Printronix page.
Call:
CALL PRINTRNX(DATA,NPTS,INDEXSTART,INCRMNT,ABSC1,ABSC2,
1LABELX,LABELY,PDATA,ISCLDATA,WORK)
Where:
NAME I/O TYPE DESCRIPTION
NAME I/O TYPE DESCRIPTION
DATA C R4 is the array containing the data to be
plotted.
NPTS C I4 is the number of data points in the array
DATA.
INDEXSTART C I4 is the starting index of the array from
where the data is to be taken.
INCRMNT C I4 is the increment to be used in stepping
through the array.
ABSC1 C R4 is the physical value along the abscissa of
the first point. This gets printed on the
output.
ABSC2 C R4 is the physical value along the abscissa of
the last point.
LABELX C CHAR is the label associated with the abscissa.
LABELY C CHAR is the label associated with the ordinate.
PDATA R R4 is a working array used by this subroutine.
ISCLDATA R I4 is also a working array used by this
subroutine.
WORK R BYTE is another working array used by this
subroutine.
Page 45
6.2.18 ADDITIONAL LOW LEVEL ROUTINES
The following is a list of additional low level modules.
For documentation on these routines, consult the individual
program listings.
TEK LASER
TEKPLOT LASERPLOT
RASTER APPLE
PRINTPLOT APPLEPLOT
GRIN VECTMODE
GRINPLOT COLORMODE
PLTREAD PENMODE
TEK4662 FILLMODE
T4662PLOT DATALEVEL
COP PLTWRITE
RAMPLOT PLOTPAR
CALCOMP PARSE
HOUSTPLOT
Page 46
6.3 PLOT FILE FORMAT
6.3 PLOT FILE FORMAT
What follows is a brief description of the format of the
standard plot file as generated by calls to the routines in the
plot library (LBY:PLOT.OLB), on the VAX 11/780 system.
The plot file format is an intermediate language in which
can be encoded completely and concisely all the plot functions
which can be generated by calls to the CALCOMP compatible plot
subroutines.
Thus, when an application program calls a plot subroutine
such as SYMBOL, all the pertinent information, such as character
position, size, number of characters to plot etc., is encoded
into this intermediate plot language. The intermediate language
is then written to a file, or interpreted immediately by an
on-line plot utility subroutine.
The instructions defined for the intermediate language and
the corresponding symbolic names for the instructions are:
End plot file PLT$OP_ENDFILE
End plot PLT$OP_ENDPLOT
Plot to a point (X,Y) with the pen down PLT$OP_PLOTDOWN
Plot to a point (X,Y) with the pen up PLT$OP_PLOTUP
Plot a string of characters PLT$OP_SYMBOL
Set the scale factor for the plot PLT$OP_SYMBOL
Select a new pen or plot colour PLT$OP_NEWPEN
Select a new origin at a point(X,Y) PLT$OP_ORIG
Plot a line from the current position PLT$OP_SYMBDOWN
to a point (X,Y) and draw a special
symbol there
Draw a special symbol at a point(X,Y) PLT$OP_SYMBUP
Exit the alpha mode on the plot device PLT$OP_ENDALPHA
Set the vector line style PLT$OP_LINESTYLE
Set the color PLT$OP_COLOR
Set the data level PLT$OP_DATALEVEL
Go to the point plot mode PLT$OP_POINTPLOT
Ring the bell PLT$OP_BELL
Go to the alpha graphics mode PLT$OP_ALPHAGRAPHICS
Go to the rectilinear graphics mode PLT$OP_RECTILINEAR
Page 47
Set the fill style for the rectilinear PLT$OP_FILLSTYLE
graphics
Select the penwidth PLT$OP_PENWIDTH
(NOTE: The definitions of the symbolic names PLT$xxxxxxx are in
the file [MIIPS.MIIPS]PLOTPAR.FOR)
The first byte of each instruction consists of an opcode (in
the least significant four bits), and special instruction
specific information (in the most significant four bits). All
instructions then have two sixteen bit words in which the
majority of the instruction specific information is encoded.
Symbol instructions then have an extra three words (making five
in all) which are to completely specify a symbol instruction.
The PLT$OP_SYMBOL instruction the has a string of bytes
containing the text to be plotted (the length of this string is
specified elsewhere in the instruction).
Page 48
The format of each of the instructions is illustrated in the
table below:
0000 0000 00 PLT$OP_ENDFILE
0000 0000 01 PLT$OP_ENDPLOT
YYYY XXXX 02 PLT$OP_PLOTDOWN
YYYY XXXX 03 PLT$OP_PLOTUP
...ZZZ YYYY XXXX AAAA NNNN HHHH T4 PLT$OP_SYMBOL
FFFF FFFF 05 PLT$OP_FACTOR
0000 0000 06 PLT$OP_NEWPEN
YYYY XXXX 07 PLT$OP_ORIG
YYYY XXXX AAAA SSSS HHHH T8 PLT$OP_SYMBDOWN
YYYY XXXX AAAA SSSS HHHH T9 PLT$OP_SYMBUP
0000 0000 0A PLT$OP_ENDALPHA
BBBB 0B PLT$OP_LINESTYLE
CCCC 0C PLT$OP_COLOR
DDDD 0D PLT$OP_DATALEVEL
0000 0000 0E PLT$OP_POINTPLOT
0000 0000 0F PLT$OP_BELL
0000 0000 10 PLT$OP_ALPHAGRAPHICS
0000 0000 11 PLT$OP_RECTILINEAR
EEEE 12 PLT$OP_FILLSTYLE
WWWW 13 PLT$OP_PENWIDTH
KEY TO INSTRUCTION TABLE:
XXXX A sixteen-bit signed integer representing an x-position
as a number of standard plotter increments (0.1mm or
.00394 inches).
YYYY As above, but for the y-position.
HHHH A sixteen-bit signed integer representing a character
size as a number of standard plotter increments.
NNNN A sixteen-bit signed integer which specifies how many
characters are in the text part of the SYMBOL
instruction.
AAAA A sixteen-bit signed integer specifying to the nearest
degree the angle at which a character or symbol is to
be plotted.
ZZZZ... A string of characters of length NNNN (see above).
FFFF FFFF A floating-point number specifying a scale factor.
SSSS A sixteen-bit signed integer specifying the number of a
special symbol (see the documentation on the CALCOMP
plot routines DOC:PLOTDOC.DC2).
T A four-bit field specifying whether symbol plotting
will take place at the current pen position (T=1) or at
the X,Y position specified elsewhere in the instruction
(T=0).
Page 49
P A four-bit field specifying the pen number of the next
pen to be used.
BBBB A sixteen-bit signed integer specifying the line style
for the plot devices.
CCCC A sixteen-bit signed integer specifying the color for
the plot devices.
DDDD A sixteen-bit signed integer specifying the data level
for the plot devices.
EEEE A sixteen-bit signed integer specifying the fill style
for the plot devices.
WWWW A sixteen-bit signed integer specifying the pen width
for the plot devices.