Issued by: Computing Service University of Southampton Date: March 1987 CALCOMP(77) P L O T T E R S O F T W A R E CONTENTS Page PREFACE 3 INTRODUCTION - 4 A SAMPLE PLOTTING PROGRAM 5 SUBROUTINE SPECIFICATIONS PLOTS ...... Initialisation routine 8 PLOT ....... Basic pen movement and origin assign 8 FACTOR ..... Enlarge or reduce plot size 9 WHERE ...... Give pen position and plot size factor 9 NEWPEN ..... Select new pen 10 AXIS ...... Draw linear axis 11 LINE ...... Draw line through set of points 12 NUMBER ..... Draw floating point number 13 SCALE ...... Calculate scaling factors 14 SYMBOL ......Draw plot annotation 17 CIRCL ...... Draw an arc which can be a circle or spiral 19 CURVX ...... Plot a function of X 19 CURVY ...... Plot a function of Y 20 DASHP ...... Draw a dashed line 21 DASHL ...... Draw a dashed line through a set of data points 21 ELIPS ...... Draw an elipse 22 FIT ...... Draw a semi-hyperbolic curve through 3 points 23 FLINE ...... Draw a smooth curve through a set of data points 24 GRID ...... Draw a linear grid 25 LGAXS ...... Draw logarithmic axes 26 LGLIN ...... Plot data in a log-log or semi-log mode 27 POLAR ...... Plots data as polar co-ordinates 29 POLY ...... Draw an equilateral polygon 30 RECT ...... Draw a rectangle 30 SCALG ...... Scale data for a logirthmic scale 31 SMOOT ...... Draw a smooth curve 32 Mar 87 2 PREFACE This booklet has been produced using diagrams and text appearing in three manuals entitled, 'Calcomp Graphics Functional Software - USAS Fortran/General-Users Manual' dated April 1969. 'Calcomp Graphics Functional Software - USAS Fortran/Scientific-Users Manual' dated July 1969. 'Programming Calcomp Electromechanical Plotters dated August 1974 The Computing Service of Southampton University thank CalComp Limited for their permission to reproduce the information from the above documents. 3 INTRODUCTION The software described in this manual is designed for use with the Calcomp 907/1051 plotting system. It consists of a library of subroutines (written in Fortran) which perform a variety of common plotting requirements (eg. drawing axes, lines, circles etc.). The subroutines are called from the user's program which is written in Fortran. In the case of the 907/1051 plotting system, the subroutines do not output directly to the plotter but into a disk file which is transferred to the plotter at a later stage. Calcomp 907/1051 plotting system The plotting system consists of a Calcomp 1051 plotter linked to a Calcomp 907 controller. The 907 controller is a small computer. It can accept plotting information and generate commands to drive the 1051 plotter. The 1051 plotter is a drum plotter. It has two different sized drums available (and therefore a choice of two paper widths) and four pen positions allowing four different colours to be used if required. The plotting paper has pre-punched sprocket holes along both edges and is held in alignment over the drum by sprockets. The pens are mounted on a carriage which moves along a traverse arm parallel to the drum axis. The smallest plotting movement increment is 0.001 inch. However, the pen width is approximately 0.01 inches, and this limits the fineness of detail that can be drawn. *------------------------------------------- * * * * N.B. Throughout this manual one plotting * * represents 0.5 inches * * * * * *------------------------------------------- * [ ] [ DIAGRAM ] [ ] 4 The user should bear the following points in mind whilst planning a graph. 1. The X-axis lies parallel to the length of the paper and the Y-axis lies parallel to the width. 2. The 4 pens are mounted on a pen carriage 1.5cm apart. The maximum distance which can be travelled in the Y direction by any pen is 12.5 inches (narrow drum) or 30 inches (wide drum). 3. The maximum length of plot in the X-direction is the length of a roll of paper (120 feet). 4. The initial position of pen 1 when the plotting operation commences is taken to be the initial origin (X=O, Y=O). This will always be the extreme Y position as shown in the diagram. All pen movements are defined in X and Y coordinates relative to the current origin. Subsequent origins can be established at other positions by appropriate programming (see subroutine PLOT). 5. Care should be taken that negative X movements do not overwrite plots. A SAMPLE PLOTTING PROGRAM CHARACTER*20 XTITL EXP00010 CHARACTER*8 YTITL EXP00020 CHARACTER*16 GTITL EXP00030 DIMENSION X(26),Y(26) EXP00040 DATA XTITL/'TIME IN MILLISECONDS'/ EXP00050 DATA YTITL/'VOLTAGE'/ EXP00060 DATA GTITL/'PERFORMANCE TEST'/ EXP00070 CALL PLOTS(0,0,8) EXP00080 READ (1,25)(X(I),Y(I),I=1,24) EXP00090 25 FORMAT(2F6.2) EXP00100 CALL PLOT(0.0,4.0,-3) EXP00110 CALL SCALE(X,10.,24,1) EXP00120 CALL SCALE(Y,12.,24,1) EXP00130 CALL AXIS(0.0,0.0,XTITL,-20,10.0,0.0,X(25),X(26)) EXP00140 CALL AXIS(0.0,0.0,YTITL,7,12.0,90.0,Y(25),Y(26)) EXP00150 CALL LINE(X,Y,24,1,2,0) EXP00160 CALL SYMBOL(0.5,5.6,0.42,GTITL,0,0.0,16) EXP00170 CALL PLOT(20.0,0.0,999) EXP001800 STOP EXP00190 END EXP00200 5 FORTRAN PROGRAM EXPLANATION LINE(S) EXPLANATION EXP00010-EXPOOO3O Reserve space for graph axis titles EXP00040 Reserve space for 24 data values plus two additional locations equired by SCALE, AXIS and LINE subroutines. EXP00050-EXP00070 Provide TITLES EXP00080 Initialise the PLOT S subroutine with the channel number of output file EXPOOO90-EXP00100 Load 24 pairs of data into two arrays X and Y EXP00110 Define a new origin 2 inches (4 x 0.5 inches) higher than the initial pen position. EXP00120 Compute the scale factors for use in plotting the x values in a 5 inch plotting area. EXP00130 Compute the scale factors for use in plotting the Y values in a 6 inch plotting area. EXP00140 Draw the X axis 5 inches long using the scale factor computed by the SCALE subroutine. EXP00150 Draw the Y axis 6 inches long using the scale factor computed by the SCALE subroutine. EXP00160 Plot Y against X values drawing a line between each of the 24 points and plotting a symbol X at every other point. EXP00170 Plot the graph title EXP000180 - EXP00190 Terminate the program Mar 87 6 EXAMPLE GRAPHICAL OUTPUT [ ] [ DIAGRAM ] [ ] 7 SUBROUTINE SPECIFICATIONS All of the subroutine specifications in this manual follow the Fortran naming conventions i.e. variables or array names starting with the letters I-N are integers, all others being real unless otherwise declared (e.g.CHARACTER). NOTE: Throughout these specifications 1 plotting unit=0.5 inches PLOTS SUBROUTINE GENERAL DESCRIPTION The PLOTS subroutine is used to perform initialisation. It must be called only once before any other graphics subroutine is called. The subroutine sets up certain constants and opens the plot output file. CALLING SEQUENCE CALL PLOTS(O,O,LDEV) LDEV is the logical channel number of the output file. (The first two arguments of the PLOTS subroutine are no longer used, but are maintained for compatibility with previous versions of the subroutine.) Information about assigning the logical channel number to the output file is available in the appropriate local documentation. PLOT SUBROUTINE GENERAL DESCRIPTION The PLOT subroutine is used to move the pen in a straight line to a new position, with the pen either up or down during the movement. It converts the input argument~ to the appropriate sequence of plotter commands and outputs these to the output file. CALLING SEQUENCE CALL PLOT(XPAGE,YPAGE,+IPEN) XPAGE are the X,Y coordinates, in plotting units from the current YPAGE origin, of the position to which the pen is to be moved. A new origin may be established on the plotting surface as described below for negative IPEN values. 8 IPEN is a signed integer which controls pen status (up or down) and origin definition. If IPEN= 2, the pen is down during movement thus drawing a visible line. 3, the pen is up during the movement. - 2, a new origin is defined at the terminal position. - 3, after the movement is completed, the X,Y coordinates of the new pen position are set to equal zero. This position is now the origin for succeeding pen movements. FACTOR SUBROUTINE GENERAL DESCRIPTION The FACTOR subroutine enables the user to enlarge or reduce the size of the entire plot. CALLING SEQUENCE CALL FACTOR(FACT) FACT is the ratio of the desired plot size to the normal plot size. COMNENTS 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. During debugging of a plot, computer and plotting time can be saved by reducing the size of the entire plot. This can be done by calling FACTOR with a value less than 1.0 after the call of the PLOTS. When debugging is complete, the call can be removed. WHERE SUBROUTINE GENERAL DESCRIPTION The WHERE subroutine sets the three variables designated in the calling sequence to the pen's current position coordinates and the plot-sizing factor. This permits the user to know the pen's current location for optimising pen movement. 9 CALLING SEQUENCE CALL WHERE (RXPAGE,RYPAGE,RFACT) RXPAGE variables that will be set to the pen's current position RYPAGE coordinates. RFACT is set to the current plot sizing factor i.e. the value last supplied by a call to EACTOR or 1.0 if FACTOR has not been called. COMMENTS A call to WHERE after a call to SYMBOL returns the coordinates of the starting point of the character string. NEWPEN SUBROUTINE GENERAL DESCRIPTION The NEWPEN subroutine enables the user to select any of the pens. Pen number 1 is initially selected when the PLOTS subroutine is called. CALLING SEQUENCE CALL NEWPEN(INP) INP specifies the number of the pen to be selected. The old pen is raised and the new pen is moved to the same physical location at which the old pen was positioned. INP = 1 BLACK INP = 2 RED INP = 3 GREEN INP = 4 BLUE Mar 87 10 AXIS SUBROUTINE GENERAL DESCRIPTION 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 produced by the AXIS subroutine which draws any length line at any angle, divides the line in 1 inch segments, annotates the divisions with appropriate scale values and labels the axis with a centred title. When both the X and Y axes are needed, AXIS is called separately for each one. CALLING SEQUENCE CALL AXIS (XPAGE,YPAGE,IBCD,+/-NCHAR,AXLEN,ANGLE,FIRSTV,DELTAV) XPAGE are the coordinates, in plotting units, of the axis line's YPAGE starting point. The entire line should be at least 1 inch from any side to allow space for the scale annotation and axis title. Usually, both the X and Y axes are joined at the origin of the graph, where XPAGE and YPAGE equal zero; but other starting points can be used. When using the LINE subroutine to plot data on an axis at least one of the coordinates must be O i.e. for an X-axis, XPAGE = O, and for a Y-axis, YPAGE = O. IBCD is the title, which is centred and placed parallel to the axis line. This parameter must be a CHARACTER constant, variable or array name. +/-NCHAR The magnitude specifies the number of characters in the axis title and the sign determines on 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 reference. If the sign is positive, all annotation appears on the positive (counterclockwise) side of the axis. This condition is normally desired for the Y-axis. If the sign is negative, all annotation appears on the negative (clockwise) side of the axis. This condition is normally desired for the X-axis. AXLEN is the length of the axis line, in plotting units (e.g. 12 units equals 6 inches). ANGLE is the angle in degrees (positive or negative), at which the axis is drawn. The value is normally 0ø for the X-axis and 90ø for the Y-axis. Mar 87 11 FIRSTV is the starting value (either minimum or maximum) which will appear at the first tick mark on the axis. This value may either be computed by the SCALE subroutine, or the value may be determined by the user. This number and scale value along the axis is drawn with two decimal places. Since the digit size is 0.105 inch, and since a scale value appears every inch, no more than six digits and a sign should appear to the left of the decimal point. DELTAV represent the number of data units per plotting unit of axis. This value (increment or decrement), may either be computed by SCALE or the value may be determined by the user. In order to use a standard format of two decimal places, 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 "*1O^n". where n is the power-of-ten adjustment factor. LINE SUBROUTINE GENERAL DESCRIPTION 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 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. CALLING SEQUENCE CALL LINE (XARRAY,YARRAY,NPTS,INC,+LINTYP,INTEQ) XARRAY is the name of the array containing the abscissa (X) values and the scaling parameters for the X-array. YARRAY is the name of the array containing the ordinate (Y) values and the scaling parameters for the Y-array. NPTS is the number of data points 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. Mar 87 12 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. +/-LINTYP is a control parameter which describes the type of line to 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. If LINTYP is zero, the points are connected by straight lines but no symbols are plotted. If LINTYP is positive, a straight line connects every data point defined in the array. (The pen is up when moving from its current position to the first point.) If LINTYP is negative, no connecting lines are drawn; only the symbols are plotted. INTEQ is the integer equivalent of the special plotting symbol centered at each data point. This value normally can be 0 through 13, and has meaning only when LINTYP is not zero. The available symbols are spec,ified in the subroutine SYMBOL definition. NUMBER SUBROUTINE GENERAL DESCRIPTION NUMBER converts a floating point number to the appropriate decimal equivalent so that the number may be plotted in the FORTRAN F-type format. CALLING SEQUENCE CALL NUMBER (XPAGE,YPAGE,HEIGHT,FPN,ANGLE,+/-NDEC) XPAGE are the same as those arguments for subroutine SYMBOL YPAGE The continuation feature, where XPAGE or YPAGE equals HEIGHT 999.0, may also be used. and ANGLE FPN is the floating-point number that is to be converted and plotted. +/-NDEC controls the precision of the conversion of the number FPM. If the value of NDEC>O, it specifies 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 (perhaps in binary form) of -0.12345678 x 10^3. If NDEC were 2, the plotted number would be -123.46. Mar 87 13 If NDEC= O, only the number's integer portion and a decimal point are plotted, after rounding. If NDEC = -1, only the number's integer portion is plotted, after rounding. (The above example would be plotted as -123 with no decimal point.) If NDEC < -1 (NDEC-1 ) digits are truncated from the integer portion, after rounding. The magnitude of NDEC should not exceed 9. SCALE SUBROUTINE GENERAL DESCRIPTION Typically, the user's program will accumulate plotting data in two arrays: An array of independent variables, Xi An array of dependent variables, Yi = f (Xi) It would be unusual if the range of values in each array corresponded exactly with the number of plotting units available in the actual plotting area. For some problems the range of data is predictable. The programmer can predetermine suitable conversion factors for use in drawing the axis scale values and plotting the data points on the eraph. Usually, however, these factors not known in advance. Therefore, the SCALE subroutine is used to examine the data values in an array and to determine a starting value (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 real data values in the array; and 2) The data points, when plotted by the LINE subroutine, will fit in a given plotting area. These two values are computed and stored by SCALE at the end of the array. The scaling factor (DELTAV) that is computed represents the number of data units per plotting unit, but is adjusted so that it is always an interval of 1,2,4,5 or 8 x lO^n (where n is an exponent consistent with the orginal unadjusted scaling factor). Thus, an array may have a range of values from 301 to 912, to be plotted over an axis of 5 inches the unadjusted scaling factor is (912-301)/10 = 61.1 units/plotting unit. The adjusted DELTAV would be 8 x 10^1 = 80. Mar 87 14 The starting value (FIRSTV), which will appear as the first annotation on 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. CALLING SEQUENCE CALL SCALE (ARRAY,AXLEN,NPTS,+/-INC) ARRAY is the first element of the array of data points to be examined. AXLEN is the length of the axis in plotting units to which the data is to be scaled. Its value must be greater than one plotting unit. 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. +/-INC 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 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); for DELTAV it is ARRAY(NPTS*INC+INC+1). Generally SCALE is called to examine each array to be plotted, as shown earlier in A SAMPLE PLOTTING PROGRAM. If the user knows the range of his data 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. Mar 87 15 The following examples illustrate some typical uses of SCALE: Example 1 Given an array of 24 data values to be plotted over a 5 inch axis, assume the minimum value in the array is 1.00 and the maximum is 42.00. The statement CALL SCALE (ARRAY,10.0,24,+1) would give the following results: Units/plotting unit = (42.00 - 1.00)/10.0 = 4.1 DELTAV (next higher interval) = 5.0 FIRSTV (minimum multiple) = 0.0 FIRSTV value is stored in ARRAY(25) DELTAV value is stored in ARRAY(26) Using these values, AXIS would draw the following axis line: Example 2 Assume that the array in Example 1 is to be plotted on an 4 inch axis, from maximum to minimum. CALL SCALE(ARRAY,8.0,24,-1) would give these results. DELTAV = (1.00 -42.00)/8.0 = -5.125 which is adjusted to -10. Minimum multiple = 0.0; FIRSTV = Minimum+(AXLEN*/DELTAV/) = 80.00. In this example, the following axis would be drawn: Example 3 Assume 100 points are to be plotted on an 4 inch axis from maximum (+22) to minimum (-9), using every other data value in the array. The DIMENSION statement should specify ARRAY(204) and the calling sequence is CALL SCALE (ARRAY,8.0,100,-2) Initial DELTAV = (-9 -22)/8= -3.87, adjusted to -4.00 Initial FIRSTV = +16.00; last value on axis = -16.00 Axis range is inadequate for the data range, so FIRSTV is revised so the last value on the axis is the minimum data value truncated to the same significance as DELTAV. Revised DELTAV = -10.00, stored in ARRAY(203). Revised FIRSTV = 30.00, stored in ARRAY(201). The resulting axis would appear as follows: Mar 87 16 SYMBOL SUBROUTINE GENERAL DESCRIPTION The SYMBOL subroutine produces plot annotation at any angle and in practically any size. CALLING SEQUENCE CALL SYMBOL (XPAGE,YPAGE,HEIGHT,IBCD,INTEQ,ANGLE,+/-NCHAR) XPAGE are the co-ordinates in plotting units of the lower left-hand 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. (Calling WHERE to obtain the current pen position and using RXPAGE, RYPAGE in another call to SYMBOL would not give the same results as using 999.) HEIGHT is the height, in plotting units of the character to be plotted. For best results, it should be a multiple of seven times the plotter increment size (e.g.0.07, 0.14, 0.21 inches), but other values are acceptable. The width of a character, including spacing is normally the same as the height (e.g., a string of 10 characters 0.14 inches high is 1.4 inches wide). if NCHAR O the data must be left-justified in the first element of IBCD. If NCHAR=O, one alphanumeric character is produced, using a single character which is right justified in the first element of IBCD. when NCHAR is negative it determines whether the pen is Up or down during the move to XPAGE,YPAGE. When NCHAR is: -1 the pen is up during the move, after which a single symbol is produced. -2 or less, the pen is down during the move, after which a single symbol is produced. [ ] [ SYMBOL TABLE ] [ ] 18 CIRCL SUBROUTINE GENERAL DESCRIPTION CIRCL draws starting at a given point, an arc which may be extended to form a circle or spiral. CALLING SEQUENCE CALL CIRCL (XPAGE,YPAGE,THO,THF,RO,RF,DI) XPAGE are the coordinates, in plotting units, of the arc's starting YPAGE point. THO is the radius angle, in degrees from the X-axis, for the start of the arc. THF is the radius angle, in degrees from the X-axis, for the end of the arc. RO is the arc's starting radius, in plotting units. RF is the arc's ending radius, in plotting units. DI is a code used to specify the type of line desired. If DI = 0.0, a solid arc is drawn; = 0.5, a dashed arc is drawn COMMENTS THO and THF may be positive or negative. If THO is less than THF, the arc is drawn in a counterclockwise direction; and if THO is greater than THF, the arc is drawn in a clockwise direction. CURVX SUBROUTINE CURVX plots a function of X over a given range. CALLING SEQUENCE CALL CURVX (XO,XF,COEFFl,EXPl,COEFF2,EXP2,COEFF3,EXP3,COEFF4,EXP4) 19 XO are the starting and ending values of X. (These are assumed to XF be in plotting units) COEFF1 COEFF2 are the coefficients of the polynomial that defines the COEFF3 function is to be plotted. COEFF4 EXP1 EXP2 are the exponents of the polynomial that defines the function EXP3 to be plotted EXP4 COMMENTS The Polynomial that defines the function to be plotted is: Y = COEFF1*X^EXP1 + COEFF2*X^EXP2 + COEFF3*X^EXP3 + COEFF4*X^EXP4 for values of X from XO to XF, where X = 0.01. Since values of X are assumed to be half inch units, any scaling required must be performed before calling this subroutine. If X is zero or negative, errors may be generated. CURVY SUBROUTINE GENERAL DESCRIPTION CURVY plots a function of Y over a given range. CALLING SEQUENCE CALL CURVY (YO,YF,COEFF1,EXP1,COEFF2,EXP2,COEFF3,EXP3,COEFF4,EXP4) YO are the starting and ending values of Y. (These are assumed YF to be in inches. COEFF1 COEFF2 are the coefficients of the polynomial that defines the COEFF3 COEFF4 EXP1 EXP2 are the exponents of the polynomial that defines the function EXP3 to be plotted EXP4 COMMENTS The polynomial that defines the function to be plotted: X = COEFF1*Y^EXP1 + COEFF2*Y^EXP2 + COEFF3*Y^EXP3 + COEFF4*Y^EXP4 for values of Y from YO to YF, where Y = 0.01. Since values of Y are assumed to be half inch units, any scaling required must be performed before calling this subroutine. If Y is zero or negative, errors may be generated. DASHP SUBROUTINE GENERAL DESCRIPTION DASHP draws a dashed line from the pen's present position to a specified point. CALLING SEQUENCE CALL DASHP (XPAGE,YPAGE,DASH) XPAGE are the coordinates, plotting units, of the point to which the YPAGE dashed line is to be drawn. DASH is the length, in plotting units, of each dash and of the space between dashes. COMMENTS If the line length is less than double the dash length, the dash length is adjusted to half the line length. DASHL SUBROUTINE GENERAL DESCRIPTION DASHL draws dashed lines connection a series of data points. CALLING SEQUENCE CALL DASHL (XARRAY,YARRAY,NPTS,INC) XARRAY is the name of the array containing the abscissas of the data points to be plotted. Mar 87 21 YARRAY is the name of the array containing the ordinates of the data points to be plotted. NPTS are the number of data points to be plotted. INC is the increment between array elements, INC is greater than 1 if the values to be plotted are in a mixed or multidimensioned array. (normally INC = 1). COMMENTS The arrays must be dimensioned with at least NPTS+2 elements. The adjusted minimum value (FIRSTV) and the adjusted delta value (DELTAV), normally provided by the SCALE subroutine, must be stored following the data array. For the X array, the adjusted minimum is stored in XARRAY(NPTS*INC+1), and the adjusted delta is in XARRAY(NPTS*INC+INC+1). Similarly, for the Y array, the minimum is in YARRAY (NPTS*INC+1), and the delta is in YARRAY(NPTS*INC+INC+1). If scaling is not required, the user must place the appropriate minimum and delta values in the specified elements of the arrays. For a one-to-one correspondence between array data and plotted data, these values should be 0.0 (minimum) and 1.0 (delta). A dashed line, is drawn connecting sequential points. Coding is optimised so that plotting may either begin at the first point and progress forward or begin at the last point and progress backward. ELIPS SUBROUTINE GENERAL DESCRIPTION ELIPS draws an ellipse or elliptical arc. CALLING SEQUENCE CALL ELIPS (XPAGE,YPAGE,RMAJ,RMIN,ANGLE,THO,THF,IPEN) XPAGE are the coordinates, in plotting units, of the starting point of YPAGE the ellipse or arc. RMAJ are the lengths, in plotting units, of the semi-major and RMIN semi-minor axes, respectively. ANGLE is the angle of the major axis, in degrees, with respect to the X direction or arc. Mar 87 22 THO are the angles, in degrees with respect to ANGLE, of the arc's THF starting and ending points. IPEN is the code that moves the pen to the arc's starting point. If the value of IPEN is: 3, the pen is up for the move; 2, the pen is down for the move. COMMENTS THO and THF may be positive or negative. If THO is less than THF, the arc is drawn in a counterclockwise direction; if THO is greater than THF, the arc is drawn in a clockwise direction. FIT SUBROUTINE GENERAL DESCRIPTION FIT draws a semi-hyperbolic curve through three points. CALLING SEQUENCE CALL FIT(XPAGE1,YPAGE1,XPAGE2,YPAGE2,XPAGE3,YPAGE3) XPAGE1,YPAGE1 are the X and Y coordinates of the three points through XPAGE2,YPAGE2 which the curve passes XPAGE3,YPAGE3 COMMENTS This subroutine generates a semi-hyperbolic fit using the three given points. A set of points for which a fit is not possible is drawn with straight-line segments. RESTRICTIONS The curve through the three points must not be multi-valued in both X and Y. That is, the middle point (XPAGE2,YPAGE2) must be between the endpoints along the X-axis or the Y-axis. XPAGE1XPAGE2>XPAGE3 or YPAGE1YPAGE2>YPAGE3 23 FLINE SUBROUTINE GENERAL DESCRIPTION FLINE plots data points from an array. Control is provided for annotating the data points with centered symbols and/or drawing straight lines or smooth curves through each successive data point. CALLING SEQUENCE CALL FLINE (XARRAY,YARRAY,NPTS,INC,LINTYP,INTEQ) XARRY is the name of the array containing the v~riables to be plotted as the abscissas. YARRAY is the name of the array containing the variables to be plotted as the ordinates. The adjusted minimum and the adjusted delta must be stored in the X and Y data arrays. Refer to Comments below. NPTS is the number of data points to be plotted: If NPTS>O a straight line is drawn between the points. If NPTS1 if the values to be plotted are in a mi~ed or multi dimensioned array. (Usually INC=1) LINTYPE is used to control the type of graph produced: if LINTYP=O a line is plotted between successive data points. if LINTYP=1 a line plot is produced, with a symbol at each datapoint. if LINTYP=2 a line plot is produced, with a symbol at every second data point. if LINTYP=n a line plot is produced, with a symbol at every nth data point. if LINTYP=-n connecting lines are not plotted between data points; a symbol appears at every nth data point. INTEQ is the integer equivalent used to specify the symbol to be plotted at a data point. (Refer to the description of SYMBOL for possible values of INTEQ.) Mar 87 24 COMMENTS The arrays must be dimensioned with a least NPTS+2 elements. The adjusted minimum value (FIRSTV) and the adjusted delta value (DELTAV), normally provided by the SCALE subroutine, must be stored following the data array. For the X array, the adjusted minimum is stored in XARRAY (NPTS*INC+1) and the adjusted delta is in XARRAY (NPTS*INC+INC+1). Similarly, for the Y array the minimum is in YARRAY (NPTS*INC+INC+1). If scaling is not required, the user must place the appropriate minimum and delta values in the specified elements in the arrays. For a one-to-one correspondence between array data and plotted data, these values should be 0.0 (minimum) and 1.0(delta). FLINE is similar to LINE, with the additional capability of drawing a smooth curve connecting data points. GRID SUBROUTINE GENERAL DESCRIPTION GRID draws a linear grid. CALLING SEQUENCE CALL GRID(XPAGE,YPAGE,DELTAX,DELTAY,NXSP,NYSP) XPAGE are the coordinates, in plotting units, of the grid's lower left YPAGE corner. DELTAX is the number of plotting units between grid lines in the X-direction. DELTAY is the number of plotting units between grid lines in the Y-direction. NXSP are the quantities of spaces between lines in the X and Y NYSP directions, respectively. COMMENTS GRID generates a linear grid of any size. The number of lines drawn is NXSP+1 in the X direction and NYSP+1 in the Y direction. Mar 87 25 LGAXS SUBROUTINE GENERAL DESCRIPTION LGAXS draws a logarithmic axis with annotation in powers of ten. CALLING SEQUENCE CALL LGAXS (XPAGE,YPAGE,IBCD,NCHAR,AgLEN,ANGLE,FIRSTV,DELTAV) XPAGE are the coordinates, in plotting units of the axis starting YPAGE point IBCD is the alphabetic data to be used as the axis title (may be one or more characters.) It must be a constant, variable or array name of type CHARACTER. NCHAR is the number of characters in the axis title. If NCHAR is: negative, annotation is placed on the clockwise side of the axis. positive, annotation is placed on the counterclockwise side of the axis. AXLEN is the length of the axis, in plotting units. ANGLE is the angle, in degrees, at which that axis is to be drawn. (The axis is rotated about XPAGE,YPAGE.) FIRSTV is the value of annotation at the beginning of the axis. DLETAV is the number of log cycles per plotting unit (the reciprocal of the length of one cycle, in plotting units.) COMMENTS A tick mark is placed on the axis for each power of ten and for each of the nine integer values between. Mar 87 26 Annotation is placed at the tick marks as follows: If a cycle is not less than 1 inch long, the integer tick marks are annotated. The power-of-ten tick marks are annotated in the form 10^N SCALG may be used for determining FIRSTV and DELTAV, if desired. LGLIN SUBROUTINE GENERAL DESCRIPTION LGLIN is used to plot data either in log-log or in semi-log mode. CALLING SEQUENCE CALL LGLIN (XARRAY,YARRAY,NPTS,INC,LINTYP,INTEQ,LOGTYP) XARRAY are the arrays containing variables to be plotted as abscissa, YARRAY and ordinate, respectively; either logarithmic or linear, depending on the value of LOGTYP. NPTS is the number of points to be plotted. INC is the increment between elements in the array. INC>1 if the values to be plotted are in a mixed or multi dimensional array. (Usually INC = 1). LINTYP is used to control the type of graph produced: If LINTYP = O a line is plotted between successive data points. If LINTYP = 1 a line plot is produced, with a symbol at each data point. If LINTYP = 2 a line plot is produced, with a symbol at every second data point. If LINTYP = n a line plot is produced, with a symbol at every nth data point. If LINTYP = -n connecting lines are not plotted between data points; a symbol appears at every nth data point. INTEQ is the integer equivalent used to specify the symbol to be plotted at a data point. (Refer to the description of SYMBOL for possible values of INTEQ). Mar 87 27 LOGTYP is a code specifying the type of plot. If LOGTYP is: - 1, a semi-log plot logarithmic in X and linear in Y is produced; O, a log-log plot is produced; + 1, a semi-log plot linear in X and logarithmic in Y is produced. COMMENTS The arrays XARRAY and YARRAY must be dimensioned with at least NPTS+2 elements. The adjusted minimum values and the delta values (normally provided by the SCALG subroutine for logarithmic data and by the SCALE subroutine for linear data) must be stored in the data arrays. For the X array, the adjusted minimum is stored in XARRAY(NPTS*INC+1), and the adjusted delta in in XARRAY(NPTS*INC+INC+1). Similarly, for the Y array, the minimum is in YARRAY(NPTS*INC+1), and the delta is in YARRAY(NPTS*INC+INC+1). If scaling is not required, the user must place the appropriate minimum and delta values in the specified locations in the arrays. For linear arrays, these values should be 0.0 (minimum) and 1.0(delta), to ensure a one-to-one correspondence between array data and plotter data. POLAR SUBROUTINE GENERAL DESCRIPTION POLAR scales and plots a radial variable of any magnitude against an angular variable (angle in radians) as polar co-ordinates. POLAR produces either a line plot (with lines connecting data points) or a point plot, centred at (0.,0.). CALLING SEQUENCE CALL POLAR (RADAR,ANGAR,NPTS,INC,LINTYP,INTEQ,RMAX,DR) 28 RADAR is the name of the array containing the radial values. ANGAR is the name of the array containing the angular values (radians). NPTS is the number of data points to be plotted. INC is the increment between elements in the array. INC >1 if the values to be plotted are in a mixed or multi dimensional array. (Usually INC = 1). LINTYP is used to control the type of graph produced: If LINTYP = O a line is plotted between successive data points. If LINTYP = 1 a line plot is produced, with a symbol at each data point. If LINTYP = 2 a line plot is produced, with a symbol at every second data point. If LINTYP = n a line plot is produced, with a symbol at every nth data point. If LINTYP = -n connecting lines are not plotted between data points; a symbol appears at every nth data point. INTEQ is the integer equivalent used to specify the symbol to be plotted at a data point. (Refer to subroutine SYMBOL specification for possible values of INTEQ). RMAX is the maximum radius for the plotting area, in plotting units. If RMAX < O., DR is used as a scale factor. DR is the scale factor. If RMAX>O.,DR is computed by POLAR subroutine; if RMAX < O., DR must contain the scale factor. DR is expressed in units of data per plotting unit. COMMENTS Angles are measured in radians counterclockwise around (0.,0.), with zero being in the +X direction. Radial values are measured from (0.,0.), with negative values being plotted radially opposite from positive values. Mar 87 29 POLY SUBROUTINE GENERAL DESCRIPTION POLY draws equilateral polygons. CALLING SEQUENCE CALL POLY (XPAGE,YPAGE,SLEN,SN,ANGLE) XPAGE are the coordinates, in plotting units, of the polygon's YPAGE starting point. SLEN is the length, in plotting units, of a side of the polygon. SN is the number of sides of the polygon. ANGLE is the angle, in degrees, of the first side of the polygon, with respect to the X direction. COMMENTS If SN is negative, a star is drawn with SN points. RECT SUBROUTINE GENERAL DESCRIPTION RECT draws rectangles. CALLING SEQUENCE CALL RECT (XPAGE,YPAGE,HEIGHT,WIDTH,ANGLE,IPEN) XPAGE are the coordinates, in plotting units , of the rectangle's YPAGE lower left corner, before rotation. HEIGHT is the rectangle's height, in plotting units. WIDTH is the rectangle's width, in plotting units.. Mar 87 30 ANGLE is the angle, in degrees, with respect to the X direction, at which the rectangle s base is to be drawn. (Rectangle is rotated about XPAGE,YPAGE). IPEN is the code that moves the pen to the rectangle's starting point. If the value of IPEN is: 3, the pen is up for the move 2, the pen is down for the move SCALG SUBROUTINE GENERAL DESCRIPTION The SCALG subroutine is used to determine scale factors of a data array to be plotted on a logarithmic scale. The scale factors are those used by subroutines LGLIN and LGAXS. CALLING SEQUENCE CALL SCALG (ARRAY,AXLEN,NPTS,INC) ARRAY is the array containing the data to be scaled. An adjusted minimum is stored in ARRAY(NPTS*INC+1), and a delta value (log cycles per plotting unit) is stored in ARRAY (NPTS*INC+INC+1). ARRAY must be dimensioned with at least NPTS+2 elements to provide storage for these scale factors. AXLEN is the maximum length, in plotting units, over which the data is to be plotted. NPTS is the number of values in ARRAY to be ~caled. INC is the increment between elements of the array. INC is greater than 1 if the values to be plotted are in a mixed or multidimensional array. (Normally INC=1). Mar 87 31 COMMENTS The array must be dimensioned with at least NPTS+2 elements. The adjusted minimum value (FIRSTV) and the delta value (DELTAV) are provided by SCALG in the data array. The adjusted minimum is stored in ARRAY(NPTS*INC+1), and the adjusted delta is in ARRAY(NPTS*INC+INC+1). Every INCth element of the array ARRAY, beginning with the first, is scanned to find the minimum and maximum values of the array. Next, the greatest value of 1On (integer n) less than or equal to the minimum value is found and then stored in ARRAY(NPTS*INC+1). Finally, the smallest value of lOm (integer m) greater than or equal to the maximum value is established. The delta value is the difference between the minimum and maximum powers of ten, divided by AXLEN, yielding log cycles per plotting unit. The delta value is stored in ARRAY(NPTS*INC+INC+1). SMOOT SUBROUTINE GENERAL DESCRIPTION SMOOT draws a smooth curve through a set of data points. It accomplishes this by using a modified spline-fitting technique. The subroutine receives a single coordinate pair on each call and accumulates the points until it has received a sufficient number to compute a pair of cubic parametric equations for a smooth curve. This accumulation method requires the user to specify an initial and a terminal call to the subroutine. The SMOOT subroutine operates in either of two modes: Smooth Mode and Plot Mode. CALLING SEQUENCE CALL SMOOT(XPAGE,YPAGE,IPEN) XPAGE are the coordinates, in plotting units of a single point through YPAGE which the pen moves. IPEN determines the mode and action of the SMOOT subroutine. 32 DETAILED DESCRIPTION The first call to SMOOT must use an IPEN value of O or -1 to put SMOOT in the Smooth Mode. If IPEN = O XPAGE,YPAGE define the initial point (P1) on the curve. The smoothing function ends at the last point (Pn). An open curve is produced. If IPEN = -1 XPAGE,YPAGE are used to define the initial point (P1) on the curve. The smoothing function continues from the last point (Pn) back to the initial point (P1). A closed curve is produced. Smooth Mode When SMOOT is in the Smooth Mode, IPEN performs the following functions. IPEN = -2 XPAGE,YPAGE are used to define points P2, P3,.......,PN-1, and a smoothed curve is drawn through the points on the curve. IPEN = -3 XPAGE,YPAGE are used to define points P2,P3,...... ,PN-1, and the pen, in the up position, is moved through these points. The smoothing function is maintained. IPEN = 2 The call is treated as a normal CALL PLOT or 3 (XPAGE,YPAGE,IPEN), and the point is not considered a point on the curve. The point of departure from the curve is the next-to-last point received by SMOOT, not the last point. When the next call to SMOOT with IPEN = -2 or -3 is received, the pen is repositioned to the point where it left the smooth curve. The smooth curve is then continued as though the calls with IPEN = 2 or 3 had not occurred. IPEN -24 is used for the terminal call while SMOOT is in the Smooth Mode. (XPAGE,YPAGE represent PN. The curve is finished, and the subroutine returns to the Plot Mode. Plot Mode SMOOT is in the Plot Mode after receiving a terminal call. If IPEN = +/-2 or +/-3 the call is treated as a normal CALL PLOT (XPAGE,YPAGE,IPEN) Mar 87 33 COMMENTS When SMOOT is called while it is in the Smooth Mode, the pen is not moved until three points on an open curve or four points on a closed curve have been received. For subsequent calls to SMOOT, the actual pen position is the next-to-last point received. Calls to other plotting subroutines may be intermixed with calls to SMOOT. Point-of-departure restrictions are the same as noted in the Smooth Mode description above. The first call to SMOOT must be IPEN=0 or -1. Issued by University of Southampton Computing Service Mar 87 34