.DISABLE ESCAPE .require 'ndk' .style chapter 0 .stc .require "ndk" .stc ^L^P .stc .fg 20 .stc .ps 65,70,4 .stc .display number "-",RL,"-" .stc .flags substitute .stc .lo 1 .stc .lm +15 .stc ^EPRODUCT DESCRIPTION\E .stc .lm -15 .stc .s 7 .stc .c text .stc ^I^B^&IPF PLOTTING SYSTEM\&\I\B .stc .S 2 .stc ^BFor Murdoch University users .stc of the LSI-11 Micro-computer .stc .s 3 .stc $$date .stc .ecn .stc .pg .stc .fg 3 .stc .nf .stc .c .stc ^B^&TABLE OF CONTENTS .stc .s 3 .stc ########SECTION PAGE\&\B .stc .f .stc .disable escape .stc .ellipses ^L .lo 1 .nnm .nah .flags index ` .flags subindex ` .ps 65,70,4 .f .nmpg .hl 1 GENERAL DESCRIPTION All plotting programs generate plotting commands via logical unit 8 to a disc file known as an Intermediate plot File (IPF). This IPF can then be used to generate plots on the various graphics devices available at Murdoch University. Plotting programs are written in Fortran and utilize the graphics subroutines described in this document. These subroutines are automatically included in the program task by use of the LINK/PLOT procedure. The following is an example of the compilation, Linking, and running of a plotting program names STRESS: .s;.nf FORT STRESS LINK/PLOT STRESS RUN STRESS .f;.s 2;.lm +6;.i -6 NOTE:#The IPF file is a binary one. To view it on the VDU, type "RUN $SEEIPF". .lm -6;.s At the end of the plot program run the IPF will contain general commands for one or more plots (or frames). Each plot is defined by calls to two subroutines described in this document: .nf;.s . . CALL PLOTS ('FILE.IPF',0,0) (initialize plot) . . . CALL PLOT (0,0,999) (terminate plot) .s 2 For program debugging purposes it is possible to directly inspect the plot commands in any plot frame on an IPF by executing the SEEIPF procedure. .s To send the contents of an IPF file to one of the physical plotting devices use one of the following procedures: .nf;.s ^&PLOT/M\&IPLOT (to a Miplot or Digiplot plotter) ^&PLOT/T\&K4006 (to a Tektronix 4006 VDU) .s .f;.lm +6;.i -6 NOTE: With the latter command, the user must be logged into the 4006 VDU. .lm -6 .pg .hl 1 SUMMARY OF PLOTTING SUBROUTINES .lm +8 .i -8 PLOTS###initiates a plot frame and must be called prior to any other plot routing. Also optionally names the IPF file. .i -8 PLOT####converts all pen movement specifications from centimeters to actual plotter commands, and outputs these to the attached device. .i -8 WHERE###returns the current pen position and plot-size scaling factor. .i -8 OFFSET##enables scaling/transformation of plotting corrdinates. .i -8 SYMBOL##draws any sequence of alphameric characters, as well as special point-plotting symbols. It calls only PLOT. .i -8 NUMBER##draws the decimal equivalent of an internal floating-point number. It calls only SYMBOL, which then calls PLOT. .i -8 SCALE###examines a data array to determine an optimum starting value and a scaling factor for use for AXIS and LINE in converting data units to plotter page dimensions. It is the only subroutine that does not call any other, because it does no actual plotting. .i -8 AXIS####draws an axis line with the appropriate scale annotation and title. It calls SYMBOL and NUMBER as well as PLOT. .i -8 LINE####plots a series of scaled data points defined by two arrays (X and Y), connecting the points with straight lines if desired. It may call SYMBOL as well as PLOT. .i -8 PAUSE###causes the pen plotter to pause and simultaneously send a message to the operator. .i -8 DSHLIN##plots a series of scaled data points defined by two arrays (X and Y). The points are connected by a line of dots,/dashes/spaces, as defined by an argument. .i -8 COLOR###selects one of 6 pens of a multi-colour plotter. .I -8 BARPLT##Plots a bar graph of unprocessed data. .i -8 PIE1/2##Plots a PIE graph of either unprocessed or processed data. .lm -8;.s 2 The argument names used in the following subroutine descriptions conform to standard FORTRAN conventions: if the first letter is I, J, K, L, M, or N,the argument must be an Integer value; if it is any other letter, the argument must be Real floating-point value. All Integer variables should be declared INTEGER either implicitly or explicitly except where specifically noted in the descriptions of the routines. .pg .hl 2 Subroutine PLOTS .nf Calling sequence: .s CALL PLOTS (FNME,0,0) .s Parameters: .s;.f;.lm +8;.i -8 FNME####This is a character array naming the physical IPF file, A new file will be created with this name, containing the plot data. If this parameter is not given, the IPF file name will be prompted for. .lm -8;.s Parameters 2 and 3 are not used. They are included for compatibility with existing plot programs. .pg .hl 2 Subroutine PLOT Most graphic applications require the generation of X-Y graphs to show the relationship between two or more sets of data. Usually these graphs can be produced easily and quickly by a suitably programmmed combination of the five supporting subroutines SCALE, AXIS, LINE, SYMBOL, and NUMBER. These subroutines do not directly produce plotting commands; they only compute appropriate arguments that define coordinates, and then call the PLOT subroutines, which generates the actual plotting commands. .s Where unique plotting requirements cannot be satisfied by using the supporting subroutines, the user can resort to the PLOT subroutine, which gives him direct control of cursor movement (to any X, Y coordinates position), cursor status (dark or bright), and termination of plotting. .s;.nf Calling Sequence: .s CALL PLOT (X,Y.NPEN) .s Parameters: .s;.lm +9;.i -9 X########is a Real value of the X-coordinate in cm. .s;.i -9 Y########is a Real value of the Y-coordinate in cm. .s;.i -9 NPEN#####is the mode of operation .s .f;.lm +6;.i -6 3#####Dark vector or move to a location .i -6 2#####Bright vector or draw to a location. .i -6 -3####Dark vector (move) and redefine origin at the new position. .i -6 -2####Bright vector (draw) and redefine origin at the new position. .i -6 13####Dark vector (move) adding the offset to each coordinate given. .i -6 -13###Dark vector (move) adding the offset to each coordinate given and redefining the origin at the new position. .i -6 -12###Bright vector (draw) adding the offset to each coordinate given and redefining the origin at the new position. .i -6 999###Terminate program. .s 2 .lm -16;.nf Example: .s CALL PLOT (.5,.5,3) .s .f This example will move a half cm up and a half cm to the right from the present origin. .s 2;.nf CALL PLOT (5.,10.,2) .S;.f This will draw a line from the present location to a point that is 5 cm to the right and 10 cm up from the origin. .pg .hl Subroutine WHERE .s .nf Calling Sequence: .s CALL WHERE (X,Y,FACT) .S Parameters: .s;.lm +6;.f .i -6 X#####is the X-coordinate in cms where the drawing mechanism is currently located. .s .i -6 Y#####is the Y-coordinate in cms where the drawing mechanism is currently located. .s .i -6 FACT##is the current scale factor that is being assumed by the system. .s 2;.lm -6;.nf Example: .s CALL WHERE (X,Y,FACT) CALL PLOT (X/2,Y/2,3) .S .F The above combination will move half the distance between the current pen location and 0,0. .s .lm +6;.i -6 NOTE;#The returned values of X and Y are not adjusted for a FACT of any value other than 1.0. .lm -6 .pg .hl 2 Subroutine FACTOR .s Calling Sequence: .sp .nf CALL FACTOR (FACT) .S Parameters: .s;.lm +6;.i -6 FACT##is the scale factor that is multiplied to each given coordinate. .lm -6 .s 2 Example: .s CALL FACTOR (2.) .S;.f Will cause all subsequent plots to be double the number of cms specified in the call to PLOT. .s CALL FACTOR (.5) .S will cause all subsequent plots to be half the number of cms specified in the call to PLOT. .pg hl 2 Subroutine OFFSET .s;.nf Calling sequence: .s CALL OFFSET (XOFF,XFACT,YOFF,YFACT) .S Parameters: .s;.lm +6;.f .i -6 XOFF##is the value that is added to each x-coordinate just before plotting with calls to PLOT with an NPEN of ^Gq\G12 or ^Gq\G13. .s;.i -6 XFACT#is the value that is multiplied by each X-coordinate for plot calls with NPEN of ^Gq\G12 or ^Gq\G13. .br Note:#This multiplication takes place prior to the addition of XOFF. .s .i -6 YOFF##is the value that is added to each Y-coordinate just prior to plotting with calls to plot with an NPEN of ^Gq\G12 or ^Gq\G13. .s .i -6 YFACT#is the value that is multiplied by each Y-coordinate just prior to plotting with calls to plot with an NPEN of ^Gq\G12 or ^Gq\G13. .lm -6 .pg .f .hl 2 Subroutine SYMBOL The SYMBOL subroutine produes plot annotation at any angle and in practicaly 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 box, octagon, triangle, etc., as well as the usual ASCII symbols (uncentered). .s The standard characters that are drawn by SYMBOL include the complete 64 character ASCII set one based on the standard 5#x#7 dot matrix. .s Both forms of the SYMBOL calling sequence have six arguments. The "standard" call is: .s CALL SYMBOL (XPAGE, YPAGE, HEIGHT, IBCD, ANGLE, +NCHAR) .lm +8 .s;.i -8 XPAGE,##are the coordinates, in cm, of the lower left-hand .BR;.i -8 YPAGE###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 XPAGE and/or YPAGE equals 999.0, and may be applied to X or Y independently. This avoids the necessity of calling WHERE to obtain the current pen position and using RXPAGE, RYPAGE in another call to symbol. Continuation is applied in the following way. If continuation is applied to both X and Y then the characters are plotted starting at the current pen coordinates. If continuation is applied in only the X direction (XPAGE set to 999) then the character string will be plotted as if continuation had been requested in both directions, but with the string displaced at right angles to the string direction by the distance Ypage (upwards if this is positive and downwards if negative). If continuation is aplied in only the Y direction (Y PAGE set to 999) the results are analogous to the above but with the string being displaced along the direction of the string by the distance XPAGE (forwards if positive, backwards if negative). .s 2 .i -8 HEIGHT##is the height in centimeters of the characters to be plotted. The actual character height will vary depending on the plot device. Suggested height values are .30 for the plotters and .35 for the 4006-1 terminal. .s The plot area of each symbol is a square. The actual symbol will be 5/7 of (height) in width. The remaining 2/7 of (height) will be for spacing from the next symbol. Thus a string of 10 characters .35 cm in height will be 1.8 cm in width. .s 2 .i -8 IBCD####is the text, in internal computer representation (usually ASCII or A-type format), to be used as annotation. The character(s) must be left- justified and contiguous in IBCD. IBCD may be a single variable, an array, or a Hollerith literal. .s The text must be right-justified in IBCD if a single character is desired and NCHAR = 0. IBCD must also be defined as INTEGER*2. Therefore, an INTEGER constant may not be used. .s If any of the characters are not in the 64 character ASCII set a boxed X is plotted indicating the character was in error. .s 2 .i -8 ANGLE###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 paralled to the X-AXIS. Rotation is counter clockwise. .s 2 .i -8 +NCHAR##is the number of characters to be plotted from IBCD. If NCHAR>0, the data must be left-justified in the first element of IBCD. .s If NCHAR = 0, one alphameric character is produced, using a single character which is right-justified in the first element of IBCD. .lm -8 .s 2 The second form is the "special" call, which produces only a single symbol based on the index value of INTEQ. .s CALL SYMBOL (XPAGE, YPAGE, HEIGHT, INTEQ, ANGLE, -ICODE) .s;.lm +8 .i -8 XPAGE,##are the same as described for the "standard" call. .i -8 YPAGE###For 0 ^Gs\G INTEQ ^Gs\G 13 XPAGE and YPAGE locate the center of the symbol. .s .i -8 HEIGHT##For 14 ^Gs\G INTEQ ^Gs\G 77 XPAGE and YPAGE locate the lower .s .i -8 ANGLE###left hand corner of the symbol. .s .i -8 INTEQ###is the integer equivalent of the desired symbol. It should be between 0 and 77, inclusive; otherwise is is taken to be 0. See appendix B for the symbols drawn. .s .i -8 -ICODE##is negative and determines whether the pen is up or down during the move to XPAGE, YPAGE. .s When ICODE is: .s;.lm +4 .i -4 -1##the pen is up during the move, after which a single symbol is produced; .i -4 -2##or less, the pen is down during the move, after which a single symbol is produced. .lm -12 .pg .hl 2 Subroutine NUMBER NUMBER converts a floating-point number to the appropriate decimal equivalent so that the number may be plotted in the FORTRAN F-type format. The NUMBER calling sequence has six arguments. .s CALL NUMBER (XPAGE, YPAGE, HEIGHT, FPN, ANGLE, ^Gq\GNDEC) .s .lm +8;.i -8 XPAGE,##are the same as those arguments descirbed for .br;.i -8 YPAGE,##Subroutine SYMBOL. The continuation feature, where .i -8 HEIGHT,##XPAGE or YPAGE equals 999., may also be used. .i -8 and .i -8 ANGLE .s .i -8 FPN#####is the floating-point number that is to be converted and plotted. .s .i -8 ^Gq\GNDEC###controls the precision of the conversion of the number FPN. If the value of NDEC>0, it specified the number of digits to the right of the decimal point that are to be converted and plotted, after proper rounding. For example, assume an internal value of -0.123456 x 10^> 3\>. If NDEC were 2, the plotted number would be -123.46. .s If NDEC = 0, only the number's integer portion and a decimal point are plotted, after rounding. .s If NDEC = -1, only the number's integer portion is plotted, after rounding. .br (The above example would be plotted as -123 with no decimal point). .s If NDEC <-1, [NDEC -1] digits are truncated from the integer portion after rounding. .s The magnitude of NDEC should not exceed 9. .lm -8 .pg .hl 2 Subroutine SCALE. Typically, the user's program will accumulate plotting data in two arrays: .s 1) an array of independent variables, X^ n\> (where n is an exponent consistent with the original unadjusted scaling factor). Thus, an array may have a range of values from 301 to 912, to be plotted over an axis of 25 cms. The unadjusted scaling factor is (912-301)/10=61.1 units/2.5 cm. The adjusted DELTAX would be 8 x 10^> 1\>=80. .s The starting value (FIRSTV), which will appear as the first annotation of the axis, is computed as some multiple of DELTAV that is equal to or outside the limits of the data in the array. For the example given above, if a minimum is wanted for FIRSTV, 240 would be chosen as the best value. If a maximum is desired instead, 960 would be selected. .s There are four arguments in the calling sequence: .s CALL SCALE (ARRAY, AXLEN, NPTS, ^Gq\GINC) .s .lm +8 .i -8 ARRAY###is the first element of the array of data points to be examined. .s .i -8 AXLEN###is the length of the axis to which the data is to be scaled. Its value must be greater than 1.0 cm. .s .i -8 NPTS####is the number of data values to be scanned in the array. The FORTRAN dimension statement should specify at least two elements more than the number of values being scanned, to allow room for SCALE to store the computed starting value and scaling factor at the end of the array. (See also note below). .s .i -8 ^Gq\GINC####is an integer whose magnitude is used by SCALE as the increments with which to select the data valeus to be scanned in the array. Normally [INC] = 1; if it is 2. every other value is examined if INC is positive, the selected starting value (FIRSTV) approximates a minimum, and the scale factor (DELTAV) is positive. .s If the INC is negative, the selected starting value (FIRSTV) approximates a maximum, and the scaling factor (DELTAV) is negative. .s If the INC = ^Gq\G1, the array must be dimensioned at least two elements larger than the actual number of data values it contains. If the magnitude of INC>1, the computed values are stored at (INC) elements and (2*INC) elements beyond the last data point. The subscripted element for FIRSTV is ARRAY (NPTS*INC+1). .S;.lm +6;.i -6 Note:#The provision of the INC and NPTS argements allows SCALE (and LINE) to extract data from 2 dimensional arrays. In this case (since by convention in FORTRAN subscripting, the first element varies fastest) if the data array is dimensioned as: .s;.c DIMENSION DATA (32,5) .S then the points DATA (I,3) for I = 1,30 could be scaled by calling SCALE with .s;.c CALL SCALE (DATA(I,3), AXLEN, 30,5) .s and the scaling parameters FIRSTV, DELTAV would be returned in DATA (31,3) and DATA (32,3). .lm -14 .S Generally, SCALE is called to examine each array to be plotted, however if the user knows the range of his values he does not have to call SCALE for that array so long as he supplies an appropriate FIRSTV and DELTAV when AXIS and LINE are called. .s The following examples illustrate some typical uses of SCALE. .s 2 ^&Example 1.\& .s Given an array of 24 data values to be plotted over a 12.5 cm axis, assume the minimum value in the array is 1.00 and the maximum is 42.00. The statement CALL SCALE (ARRAY, 12,5,24, +1) would give the following results. .s .nf Units/ 2.5 cm = (42.00 - 1.00)/5.0 = 8.2 DELTAV (next higher interval) = 10. FIRSTV (minimum multiple) = 0.00 .s FIRSTV value is stored in ARRAY (25) DELTAV value is stored in ARRAY (26) .s Using these values , AXIS would draw the following axis line. .s .underline spaces ^G BDDDDDDDDDBDDDDDDDDDDBDDDDDDDDDDBDDDDDDDDDDBDDDDDDDDDDB\G 0 10 20 30 40 50 .s 3 .f ^&Example 2.\& .s Assume that the array of Example 1 is to be plotted on a 10 centimeter axis, from maximum to minimum. CALL SCALE (ARRAY, 10, 24, -1) would give these results. .s;.nf DELTAV = (1.00 - 42.00/4.0 = -10.25, which is adjusted to -20 Minimum multiple = 0.00; FIRSTV = Minimum + (AXLEN * [DELTAV]) = 80.00. .s In this case the following axis would be drawn. .s ^G BDDDDDDDDDBDDDDDDDDDDBDDDDDDDDDDBDDDDDDDDDDB\G 80 60 40 20 0 .f .s 3 ^&Example 3\& .s Assume 100 points are to be plotted on a 10 cm axis from maximum (+22) to minimum (-9), using every other data value in the array. The DIMENSION statement should specifiy ARRAY (204), and the calling sequence is CALL SCALE (ARRAY, 10, 100, -2). .s Initial DELTAV = (-9-22)/4 = -7.75, adjusted to -8. Initial FIRSTV = +16.00; last value on axis = -16.00. The axis range is inadequate for the data range, so DELTAV is revised to the next higher interval. Revised to the next higher interval. Revised DELTAX = -10., stored in ARRAY (203). Revised FIRSTV = 30.00, stored in ARRAY (210). .s The resulting axis would appear as follows: .s .nf ^G BDDDDDDDDDBDDDDDDDDDDBDDDDDDDDDDBDDDDDDDDDDB\G 30 20 10 0 -10 .f .pg .hl 2 Subroutine AXIS Most graphs require axis lines and scales to indicate the orientation and values of the plotted data points. The most common type of scaled axis is easily produced by the AXIS subroutine, which draws any length line at any angle, divides it into 2.5 cm segments, annotates the divisions with appropriate scale values, and labels the axis with a centered title. When both the X and the Y axes are needed, AXIS is called separately for each one. .s There are eight arguments in the calling sequence: .s CALL AXIS (XPAGE, YPAGE, IBCD, ^Gq\GNCHAR, AXLEN, ANGLE, FIRSTV, DELTAX) .S .lm +10 .i -10 XPAGE,####are the coordinates, in centimeters, of the axis line's .i -10 YPAGE.####starting point. The entire line and terminal ends should be at least two cm from any side to allow space for the scale annotation and axis title. Usually, both the X and the Y axes are joined at the origin of the graph, where XPAGE and YPAGE equal zero; but other starting points can be used if desired. .s .i -10 IBCD######is the title, which is centered and placed parallel to the axis line. This parameter may be an alphameric array, or it may be a Hollerith literal. The characters have a fixed height of 0.3 cms. .s .i -10 ^Gq\GNCHAR####specifies the number of characters in the axis title, and determined by its sign which side of the line the scale (tick) marks and labelling information shall be placed. Since the axis line may be drawn at any angle, the line itself is used as a referene. .s If the sign is positive, all annotation appears on the positive (counterclockwise) side of the axis, which condition is normally desired for the Y-axis. .s If the sign is negative, all annotatin apears on the negative (clockwise) side of of the axis, which condition is normally desired for the X-axis. .s .I -10 AXLEN#####is the length of the axis line, in centimeters. .s .i -10 ANGLE#####is the angle, in positive or negative degrees, at which the axis is to be drawn. Normally, this value is zero for the X-axis and 90.0 for the Y-axis. .s .i -10 FIRSTV####is the starting value (either minimum or maximum) which will appear at the first tick mark on the axis. This value may be computed by the SCALE subroutine and stored at subscripted location ARRAY (NPTS*INC+1), or may be determined by the user and stored anywhere. .s The representation of this number and each scale value along the axis is determined by the adjusted value of DELTAV (see below). If the magnitude of the adjusted value is greater than 1, the decimal point is omitted, if greater than or equal to 0.1 but less than 1, one digit is drawn after the decimal point, and if less than 0.1, two digits are drawn after the decimal point. .s It would be noted that since the numbers are drawn 0.3 cms high and the tick marks are at 2.5 cm intervals, the number of digits (including decimal point and sign where necessary) should not exceed 8 and preferably 7. .s .i -10 DELTAV#### represents the number of data units per 2.5 cm of axis. This value (increments or decrement), which is added to FIRSTV for each succeeding 2.5 cm division along the axis, may be computed by SCALE and stored beyond FIRSTV at ARRAY (NPTS*INC+INC+1), or may be determined by the user and stored anywhere. .s The size of DELTAV is adjusted to less than 100, but not less than 0.01. As a result, the decimal point may be shifted left or right in the scale values as drawn, and the axis title is then followed by "*10^> n\>", where n is the power- of-ten adjustment factor. .s .lm -10 .pg .hl 2 Subroutine LINE 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. .s The scaling parameters corresponding to FIRSTV and DELTAV (see SCALE) must immediately follow each array. If these parameters have not been computed by the SCALE subroutine they must be supplied by the user. .s The calling sequence has six arguments: .s CALL LINE (XARRAY, YARRAY, NPTS, INC, ^Gq\GLINTYPE, INTEQ) .s .lm +10 .i -10 XARRAY#####is the name of the array containing the abscissa (X) values and the scaling parameters for the X-array. .s .i -10 YARRAY#####is the name of the array containing the ordinate (Y) values and the scaling parameters for the Y-array. .s .i -10 NPTS######is the number of data points to be plotted in each of the two arrays just mentioned. The number does not include the extra two locations for the scaling parameters. The number of points in each array must be the same. .s .i -10 INC#######is the increment that the LINE subroutine is to use in gathering data from the two arrays, as described previously for the SCALE subroutine. .s .i -10 ^Gq\GLINTYP###is a control parameter which describes the type of line t be drawn through the data points. The magnitude of LINTYP determines the frequency of plotted symbols; e.g. if LINTYP = 4 , a special symbol (denoted by INTEQ) is plotted at every fourth data point. .s If LINTYP is zero, the points are connected by straight lines but not symbols are plotted. .s If LINTYP is positive, a straight line connects every data point defined in the array. A special symbol (INTEQ) is plotted at every LINTYP^> th\> data point. .s If LINTYP is negative, no connectnig lines are drawn; only the symbols are plotted at every LINTYP^> th\> data point. .s .i -10 INTEQ#####This has meaning only when LINTYP is not zero. It is the integer equivalent of the plot symbol centered at each designated data point and must be in the range 0-77, inclusive. See Appendix B for the symbols drawn. .s .lm -10 .pg .hl 2 Subroutine PAUSE A call to subroutine PAUSE enables the calling program to pause the plot spooler at any time during the plotting and simulaneously send a message of up to 72 characters to the operator console. The operator can read the instructions on the console, make the required adjustments to the plotter, then continue the plotting. .s The calling sequence is: .s .nf CALL PAUSE (NCHAR,MESG) .s where NCHAR = Number of characters in the message. .s MESG = Hollerith constant or the name of an array containing the Hollerith text. .s .f As an example, suppose that the user requires plotting in two colours. At the appropriate place in the program he may insert the instruction: .s CALL PAUSE (17,17HCHANGE TO RED PEN) .pg .hl 2 Subroutine COLOR .f Subroutine COLOR is used to select a particular pen number when outputting to a hardcopy device. The calling sequence is: .s CALL COLOR (N) .s Where: N is an integer in the range 1 - 256. .s NOTES: .S .LM +4 .i -4 1.##If the output device does not support multicolor this call will have no effect. .s .i -4 2.##The actual range of argument N depends on the number of colors supported. For example a Wanatabe pen plotter supports six colors, so N must be in the range 1 - 6. .s .i -4 3.##Unless a call to COLOR selects otherwise, the plotting color is 1 which by convention is black. .pg .hl 2 Subroutine DSHLIN General Description .s Subroutine DSHLIN produces a line plot of the pairs of data values in two arrays: XARRAY and YARRAY. As with subroutine LINE, the scaling parameters corresponding to FIRSTV and DELTAV must immediately folow the data in each array. .s The calling sequence is: .s CALL DSLIN (XARRAY, YARRAY, NPTS, INC, LPATRN) .s where: .s .lm +10 .i -10 XARRAY####is the name of the array containing the abscissa (X) values and the scaling parameters for the X values. .s .i -10 YARRAY####is the name of the array containing the ordinate (Y) values and the scaling parameters for the Y values. .s .i -10 NPTS######is the number of data points to be plotted in each of the two arrays just mentioned. The number does not include the extra two locations for the scaling parameters. The number of points in each array must be the same. .s .i -10 INC#######is the increment that the LINE subroutine is to use in gathering data from the two arrays, as described previously for the SCALE subroutine. .s .i -10 LPATRN####is an integer of up to 9 digits that defines the "dash-blank" pattern of the plot line. .s .lm -10 .c NOTES ON LPATRN .s A Single-Digit LATRN .s The following results are obtained: .s .nf LPATRN RESULT .s -1 No line drawn between points 0 A solid line 1 A dotted line (in fact, the "dots" appear as short "dashes") 2 A dash-dot line 3 A short-dashed line 4 A long-dashed line .s 2 A Multiple-Digit LPATRN .s;.f Line patterns may be defined by a concatenation (i.e. combination) of the following integers: .s;.nf INTEGER RESULT .s 1 5 raster units, visible 2 5 raster units, invisible 3 10 raster units, visible 4 10 raster units, invisible 5 25 raster units, visible 6 25 raster units, invisible 7 50 raster units, visible 8 50 raster units, invisible .s .f As a rough guide, a line segment of 25 raster units is about 9 mm in length on a full-size pen plot. The line would be about 4.5 mm on a full-size TEKTRONIX graphics plot. .s An example, the concatenation "1278" would produce a line with the following pattern: .s .nf 5 raster units visible, 5 raster units invisible, 50 raster units visible, 50 raster units invisible, 5 raster units visible, 5 raster units invisible, ... .f .pg .hl 2 Subroutines BARBOX/BARPLT These routines will plot a histogram of given data. Data may be supplied in a file and extracted with a given format or supplied in an array. Routine BARBOX must be called prior to BARPLT to draw the surrounding box and labels. The status parameter in both routines is used bi-directionally. On input it defines initialization criteria (single or multiple plots per page) and on output the success status. Other parameters allow for positioning of the plot and amplification size. .s;.nf Calling Sequence: .s CALL BARBOX (IPF,COLR,X,Y,FACT,TIT,XTIT,YTIT,IST) CALL BARPLT (FNME,FMT,YARR,XSTART,XINC,NUMBAR,ISTAT) .s Parameters: (Barbox) .s IPF An INTEGER array containing IPF file name must end with a zero - see example. COLR .True. for multi-color, .false. for mono color X The lower left x-coordinate of the box (>2.0) Y The lower left Y-coordinate of the box (>2.0) FACT The size factor 1.0 = (10X10)cm box TIT Histogram title (25 chars) XTIT The title for the X axis (20 chars) YTIT The title for the Y axis (20 chars) IST On Input: 0 Request new plot frame >0 Append bargraph to same plot. Return status: 0 Success -1 X or Y coord less than 2.0cm. .s;.tp 20 Parameters:(Barplt) .s FNME Name of file containing data. 0 in byte 1 means no file. FMT Character array containing the run time format e.g. '(9X,F6.0)' - note the brackets must be given. YARR If byte 1 of FNME is zero, or ' ', data is assumed to be in this array. The last array element must be -999.. XSTART Starting value of the horizontal axis. XINC The width of a bar in X units. NUMBAR The number of bars in the horizontal (integer <50). ISTAT On Input: 0 Last plot of the program >0 More plots to follow Returned status 0 Success -1 BARBOX was not called FATAL. -2 NUMBAR exceeds maximum (50) -3 Error in Format parameter .pg .f .hl 2 Subroutines PIE1/PIE2 These routines will plot a histogram of given data. Data may be supplied in a file and extracted with a given format or supplied in an array. Data may be either ^Iraw\I or ^Iprocessed\I. Raw data is a sequential list of numbers that will be grouped in accordance to parameters in routine PIE2. Processed data is data that has already been grouped and is supplied as a list, sequenced in the same order as the division names (given as a PIE2 parameter). The type of processing is specified in the STATUS parameter. Routine PIE1 must be called prior to PIE2 to initialize the plot and draw labels. The status parameter in both routines is used bi-directionally. On input it defines initialization criteria (single or multiple plots per page) and on output the success status. Other parameters allow for positioning of the plot and amplification size. .s See Appendix B for a sample program. .s;.nf Calling Sequence: .s CALL PIE1(IPF,COLR,XS,YS,FACT,ITLE,ISTAT) CALL PIE2(FNME,FMT,YARR,NAMDIV,DIVST,DIVINC,NUMDIV,ISTAT) .S Parameters: (PIE1) .s IPF Name of IPF file COLR True for multi-color, false for mono color XS The X coord of the of the bottom left. YS The Y coord of the bottom left. FACT The size factor 1.0 = 10cm diam circle ITLE Title (25 characters) at bottom of circle ISTAT On Input: 0 Request new plot frame >0 Append bargraph to same plot. Return status: 0 Success .s Parameters: (PIE2) .s (See Over) .pg Parameters: (PIE2) .s FNME Name of file containing data. 0 in byte 1 means no file. FMT Character array containing the run time format YARR If byte 1 of FNME is zero,or ' ', data is assumed to be in this array. The last array element must be -999.. NAMDIV A 25 element array of names of the pie divisions Each element must be 10 chars long i.e - "BYTE NAMDIV(10,25)." DIVST Starting value of divisions. DIVINC The real division increment. NUMDIV The number of divisions in the pie circle. ISTAT On Input: +ve Last plot of the program -ve More plots to follow 1 Data is raw - to be pied before plotting. 2 Data already pied - just plot it. Returned status: 0 Success -1 PIE1 was not called first FATAL. -2 NUMDIV exceeds maximum (25) -3 Error in Format parameter -4 Less than 2 data divisions. .pg .ax Sample Bargraph Program .nf integer ipf(5) character*25 itle character*20 xtit,ytit real xdat(50) data ipf/'TE','ST','.I','PF',0/ data itle/'TEST DATA'/,xtit/'POPULATION'/,ytit/'FREQUENCY'/ data xdat/10.,12.,16.,42.,57.,33.,27.,39.,1.,59.,22.,14., 1 30.,60.,56.,2.,38.,40.,17.,47.,4.,28.,43.,27., 1 18.,19.,20.,16.,13.,17.,12.,14.,14.,17.,16.,19., 1 11.,11.,13.,15.,16.,17.,20.,30.,24.,23.,16.,19., 1 20.,-999./ ist=0 call barbox(ipf,.false.,2.5,2.5,1.,itle,xtit,ytit,ist) if (istat.eq.0)goto 10 print 100,istat 100 format(' BARBOX error ',i4) stop 13 10 istat=0 call barplt(' ',,xdat,0.,6.,10,istat) if (istat.eq.0)goto 20 print 200,istat 200 format(' BARPLT error ',i4) stop 13 20 stop end .pg .ax Sample PIE CHART. .nf integer*4 ipf(3),fnme(3) character*10 divn(10) character*25 itle data divn/'0 - 5','5 - 10','10 - 15','15 - 20','20 - 25', 1 '25 - 30','30 - 35','35 - 40','40 - 45','45 - 50'/ data ipf/'test','.ipf',0/ data fnme/'test','.dat',0/ data itle /'TEMPERATURE'/ ISTAT=0 CALL PIE1(IPF,.FALSE.,1.,1.,1.,ITLE,ISTAT) IF(ISTAT.EQ.0)GOTO 10 PRINT 100,ISTAT 100 FORMAT(' Error ',i3,' In PIE1') stop 'Eeeeeek' 10 istat=2 CALL PIE2(FNME,'(F1.0)',,DIVN,0.,10.,10,ISTAT) IF(ISTAT.EQ.0)GOTO 20 PRINT 200,ISTAT 200 FORMAT(' Error ',i3,' In PIE2') stop 'Eeeeeek' 20 STOP END .pg .ax Sample Program .s 4 .nf DIMENSION X(10),Y(10) INTEGER XNAME(7),YNAME(7),NME(5) DATA X/0.76,1.0,2.1,3.21,3.47,4.58,7.19,10.2,0.0,0.0/ DATA Y/18.2,20.1,34.3,58.7,71.8,72.5,83.1,212.3,0.0,0.0/ DATA XNAME/'X-','CO','OR','DI','NA','AT','E '/ DATA YNAME/'Y-','CO','OR','DI','NA','AT','E '/ DATA NME/'TE','ST','-P','LO','T '/ CALL PLOTS(1,2,3) CALL PLOT(3.0,2.0,-3) CALL SCALE(X,20.,8,1) CALL SCALE(Y,15.,8,1) CALL AXIS(0.,0.,XNAME,-12,15.,0.,X(9),X(10)) CALL AXIS(0.,0.,YNAME,+12,10.,90.,Y(9),Y(10)) CALL LINE(X,Y,8,1,+1,10) CALL SYMBOL(5.,1.2,.5,NME,0.,10) CALL PLOT(15.,10.,999) STOP END \L