*DECK SPLOTS
      SUBROUTINE SPLOTS(NPLOTS,NPTS,X,Y)
C...
C...  SUBROUTINE SPLOTS PRINTS A PLOT OF ONE OR MORE DEPENDENT VARIABLES
C...  VS ONE INDEPENDENT VARIABLE ON A STANDARD CRT (IT USES ONLY
C...  FORTRAN 77 AND ALPHANUMERIC CHARACTERISTICS).  ALL VARIABLES
C...  ARE FIRST SCALED AUTOMATICALLY AND AXES WITH NUMERICAL SCALES ARE
C...  THEN DRAWN ACCORDING TO A PREPROGRAMMED FORMAT.  THE NUMBER OF
C...  DEPENDENT VARIABLES IS LIMITED ONLY BY THE SIZE OF THE DIMENSION
C...  STATEMENT IN THE CALLING PROGRAM.  ALSO, THE DEPENDENT AND IN-
C...  DEPENDENT VARIABLES CAN BE PASSED TO SUBROUTINE SPLOTS IN ANY
C...  ORDER.  THE ONLY REQUIREMENT IS THAT THESE VARIABLES MUST BE
C...  PAIRED.  SUBROUTINE SPLOTS IN TURN CALLS THREE OTHER SUBROUTINES
C...
C...     (1)  SSKPT
C...     (2)  STYPIT
C...     (3)  SGZRO
C...
C...  THE SYSTEM OF FOUR SUBROUTINES WAS ORIGINALLY DEVELOPED BY
C...
C...     PROFESSOR MORRIS BADER
C...     DEPARTMENT OF CHEMISTRY
C...     MORAVIAN COLLEGE
C...     BETHLEHEM, PA  18018
C...
C...  AND WAS MODIFIED FOR USE IN THE DSS/2 SYSTEM
C...
C...  ARGUMENT LIST
C...
C...     NPLOTS  NUMBER OF DEPENDENT VARIABLES TO BE PLOTTED (INPUT)
C...
C...     NPTS   NUMBER OF VALUES OF EACH DEPENDENT VARIABLE AND THE
C...            INDEPENDENT VARIABLE TO BE PLOTTED (INPUT)
C...
C...     X      ONE-DIMENSIONAL ARRAY CONTAINING NPTS VALUES OF THE
C...            INDEPENDENT VARIABLE (I.E. X MUST BE DIMENSIONED AS
C...            X(NPTS) IN THE CALLING PROGRAM) (INPUT)
C...
C...     Y      TWO-DIMENSIONAL ARRAY CONTAINING NPTS VALUES OF EACH OF
C...            THE NPLOTS DEPENDENT VARIABLES (I.E. Y MUST BE DIMEN-
C...            SIONED AS Y(NPLOTS,NPTS) IN THE CALLING PROGRAM) (INPUT)
C...
C...  TYPE REAL VARIABLES AS DOUBLE PRECISION
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C...
      COMMON/IO/NI,NO
      DIMENSION X(NPTS),Y(NPLOTS,NPTS),XSCL(51),YSCL(22),ILINE(51)
C...
C...  FIND THE MAXIMUM AND MINIMUM VALUES OF THE INDEPENDENT VARIABLE
      XMIN=X(1)
      XMAX=X(1)
      DO 1 I=1,NPTS
      IF(X(I).GT.XMAX)XMAX=X(I)
1     IF(X(I).LT.XMIN)XMIN=X(I)
C...
C...  FIND THE MAXIMUM AND MINIMUM VALUES OF EACH OF THE DEPENDENT
C...  VARIABLES
      YMIN=Y(1,1)
      YMAX=Y(1,1)
      DO 2 I=1,NPLOTS
      DO 2 J=1,NPTS
      IF(Y(I,J).LT.YMIN)YMIN=Y(I,J)
2     IF(Y(I,J).GT.YMAX)YMAX=Y(I,J)
C...
C...  COMPUTE THE BASIC PLOTTING INCREMENTS FOR THE INDEPENDENT VARIABLE
C...  AND THE DEPENDENT VARIABLE WITH THE GREATEST RANGE
      SCALX=(XMAX-XMIN)/50.0D+00
      SCALY=(YMAX-YMIN)/15.0D+00
C...
C...  COMPUTE THE DISCRETE VALUES OF THE INDEPENDENT AND DEPENDENT
C...  VARIABLES TO BE USED IN PRINTING THE PLOT (I.E. THE VALUES WHICH
C...  APPEAR ALONG THE AXES OF THE INDEPENDENT AND DEPENDENT VARIABLES)
      DO 3 I=1,51
      XSCL(I)=XMIN+DFLOAT(I-1)*SCALX
3     CONTINUE
      DO 10 I=1,22
      YSCL(I)=YMAX-DFLOAT(I-1)*SCALY
10    CONTINUE
C...
C...  SKIP TO THE TOP OF A NEW PAGE TO BEGIN THE PLOT
      WRITE(NO,4)
4     FORMAT(1H1)
C...
C...  PRINT THE TOP LINE OF THE PLOT
      CALL SGZRO(0,ILINE)
C...
C...  PRINT THE NEXT 16 LINES OF THE PLOT
      DO 5 K=1,16
C...
C...  FILL ALL OF THE 51 CHARACTERS PER LINE (I.E. ILINE(51)) WITH
C...  BLANKS INITIALLY
      CALL SGZRO(K,ILINE)
C...
C...  INPUT TO ARRAY ILINE THE CHARACTERS TO BE PLOTTED IN THE KTH LINE.
C...  THIS PROCESS IS PERFORMED FOR ALL NPTS VALUES OF EACH DEPENDENT
C...  VARIABLE
      CALL SSKPT(NPLOTS,NPTS,K,X,Y,YSCL,XMIN,SCALX,ILINE)
C...
C...  PRINT THE KTH LINE OF THE PLOT (I.E. THE CHARACTERS STORED IN
C...  ARRAY ILINE BY THE PRECEDING CALL TO SKPT)
5     CALL STYPIT(K,YSCL,ILINE)
C...
C...  PRINT THE BOTTOM LINE OF THE PLOT (I.E. THE AXIS OF THE INDEPEND-
C...  ENT VARIABLE)
      CALL SGZRO(0,ILINE)
C...
C...  PRINT THE VALUES OF THE INDEPENDENT VARIABLE BENEATH THE BOTTOM
C...  LINE OF THE PLOT
      WRITE(NO,6)(XSCL(I),I=1,51,10)
6     FORMAT(10X,D10.3,5D10.2)
      RETURN
      END
      SUBROUTINE SSKPT(NPLOTS,NPTS,K,X,Y,YSCL,XMIN,SCALX,ILINE)
C...
C...  SUBROUTINE SSKPT SELECTS THE CHARACTERS TO BE PRINTED IN EACH LINE
C...  OF THE PLOT
C...
C...  ARGUMENT LIST
C...
C...     NPLOTS  NUMBER OF DEPENDENT VARIABLES TO BE PLOTTED (INPUT)
C...
C...     NPTS    NUMBER OF VALUES OF EACH DEPENDENT VARIABLE TO BE
C...             PLOTTED (INPUT)
C...
C...     K       NUMBER OF THE LINE FOR WHICH THE PRINTED CHARACTERS ARE
C...             TO BE DETERMINED (INPUT)
C...
C...     X       ONE-DIMENSIONAL ARRAY OF INDEPENDENT VARIABLE VALUES
C...             (INPUT)
C...
C...     Y       TWO-DIMENSIONAL ARRAY OF DEPENDENT VARIABLE VALUES
C...             (INPUT)
C...
C...     YSCL    ONE-DIMENSIONAL ARRAY OF THE DISCRETE VALUES PRINTED
C...             ALONG THE AXIS OF THE DEPENDENT VARIABLES (INPUT)
C...
C...     XMIN    MINIMUM VALUE OF THE INDEPENDENT VARIABLE (INPUT)
C...
C...     SCALX   BASIC PLOTTING INCREMENT FOR THE INDEPENDENT VARIABLE
C...             (INPUT)
C...
C...     ILINE   ONE-DIMENSIONAL ARRAY CONTAINING THE CHARACTERS TO BE
C...             PRINTED IN THE KTH LINE OF THE PLOT (OUTPUT)
C...
C...  TYPE REAL VARIABLES AS DOUBLE PRECISION
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C...
C...  IF MORE THAN TEN DEPENDENT VARIABLES ARE TO BE PLOTTED, ARRAY
C...  ISYM(11) IN THE FOLLOWING DIMENSION STATEMENT MUST BE INCREASED.
C...  THE REQUIRED SIZE IS THE NUMBER OF DEPENDENT VARIABLES PLUS ONE
      DIMENSION X(NPTS),Y(NPLOTS,NPTS),ILINE(51),YSCL(52),ISYM(11)
C...
C...  ******************************************************************
C...  THE FOLLOWING DATA STATEMENTS DEFINING THE CHARACTERS TO BE
C...  PRINTED IN THE PLOT MAY HAVE TO BE CHANGED FOR IMPLEMENTATION ON
C...  COMPUTERS OTHER THAN THE CDC CYBER SERIES
      DATA ISYM/1H1,1H2,1H3,1H4,1H5,1H6,1H7,1H8,1H9,1H0,1HC/
      DATA IBLK/1H /
C...  ******************************************************************
C...
C...  DETERMINE IF THE JTH VALUE OF THE ITH DEPENDENT VARIABLE IS WITHIN
C...  THE RANGE OF THE DEPENDENT VARIABLE TO BE PLOTTED IN THE KTH LINE
      DO 1 I=1,NPLOTS
      DO 1 J=1,NPTS
      IF(Y(I,J).GT.YSCL(K))GO TO 1
      IF(Y(I,J).LE.YSCL(K+1))GO TO 1
C...
C...  IF THE DEPENDENT VARIABLE IS WITHIN THE PROPER LIMITS FOR PLOTTING
C...  ON THE KTH ROW, DETERMINE THE LOCATION OF THE ASSOCIATED VALUE OF
C...  THE INDEPENDENT VARIABLE IN TERMS OF THE INDEX M
      M=INT(SNGL((X(J)-XMIN)/SCALX+1.5D+00))
      IF(M.LT.1)GO TO 1
      IF(M.GT.51)GO TO 1
C...
C...  TEST IF THE MTH PRINT POSITION ON THE KTH ROW HAS ALREADY BEEN
C...  FILLED BY A CHARACTER.  IF SO, FILL THIS POSITION WITH THE CHAR-
C...  ACTER C
      IF(ILINE(M).EQ.IBLK)GO TO 2
      ILINE(M)=ISYM(11)
      GO TO 1
C...
C...  SET THE MTH POSITION IN THE KTH ROW TO THE CHARACTER (NUMBER) OF
C...  THE ITH DEPENDENT VARIABLE IF THIS POSITION HAS NOT BEEN PREVIOUS-
C...  LY FILLED
2     ILINE(M)=ISYM(I)
1     CONTINUE
      RETURN
      END
      SUBROUTINE STYPIT(K,YSCL,ILINE)
C...
C...  SUBROUTINE STYPIT PRINTS EACH LINE OF THE PLOT USING THE CHARAC-
C...  TERS SELECTED BY SUBROUTINE SSKPT
C...
C...  ARGUMENT LIST
C...
C...     K      NUMBER OF THE LINE TO BE PRINTED (INPUT)
C...
C...     YSCL   ONE-DIMENSIONAL ARRAY CONTAINING THE DISCRETE VALUES TO
C...            BE PRINTED ALONG THE AXIS OF THE DEPENDENT VARIABLES
C...            (INPUT)
C...
C...     ILINE  ONE-DIMENSIONAL ARRAY CONTAINING THE CHARACTERS TO BE
C...            PRINTED IN THE KTH LINE OF THE PLOT (INPUT)
C...
C...  TYPE REAL VARIABLES AS DOUBLE PRECISION
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C...
      COMMON/IO/NI,NO
      DIMENSION YSCL(52),ILINE(51)
      JS=K+4
      IF((JS-JS/5*5).NE.0)GO TO 1
C...
C...  PRINT THE KTH LINE INCLUDING THE NUMERICAL VALUE ALONG THE AXIS OF
C...  THE DEPENDENT VARIABLE
      WRITE(NO,2)YSCL(K),(ILINE(I),I=1,51)
2     FORMAT(3X,D10.3,1H+,2X,51A1,2X,2H+I)
      GO TO 3
C...
C...  PRINT THE KTH LINE WITHOUT A NUMERICAL VALUE ALONG THE AXIS OF THE
C...  DEPENDENT VARIABLE
1     WRITE(NO,4)(ILINE(I),I=1,51)
4     FORMAT(13X,1H-,2X,51A1,2X,2H-I)
3     RETURN
      END
      SUBROUTINE SGZRO(K,ILINE)
C...
C...  SUBROUTINE SGZRO HAS A TWO-FOLD PURPOSE
C...
C...     (1)  TO PRINT THE TOP AND BOTTOM LINES OF THE PLOT
C...
C...     (2)  TO INITIALIZE THE ONE-DIMENSIONAL ARRAY CONTAINING THE
C...          CHARACTERS FOR EACH LINE OF THE PLOT BY SETTING ALL OF THE
C...          ELEMENTS OF THE ARRAY TO A BLANK CHARACTER
C...
C...     ARGUMENT LIST
C...
C...     K      KTH LINE TO BE INITIALIZED (I.E. BLANK-FILLED).  IF K
C...            IS ZERO, THE TOP AND BOTTOM LINES OF THE PLOT ARE
C...            PRINTED (INPUT)
C...
C...     ILINE  ONE-DIMENSIONAL ARRAY CONTAINING THE CHARACTERS TO BE
C...            PRINTED IN THE KTH LINE OF THE PLOT.  ILINE IS BLANK-
C...            FILLED BY SUBROUTINE SGZRO FOR K NOT ZERO (INPUT)
C...
C...  TYPE REAL VARIABLES AS DOUBLE PRECISION
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
C...
      COMMON/IO/NI,NO
      DIMENSION ILINE(51)
C...
C...  ******************************************************************
C...  THE FOLLOWING DATA STATEMENT DEFINES THE CHARACTERS TO BE PRINTED
C...  IN THE TOP AND BOTTOM LINES OF THE PLOT PLUS THE CHARACTER TO
C...  BLANK-FILL ARRAY ILINE.  THIS STATEMENT MAY HAVE TO BE CHANGED FOR
C...  IMPLEMENTATION ON COMPUTERS OTHER THAN THE CDC CYBER SERIES
      DATA IPER,IN,IBLK/1H.,1H1,1H /
C...  ******************************************************************
C...
      IF(K.EQ.0)GO TO 2
C...
C...  BLANK-FILL ARRAY ILINE FOR INITIALIZATION
      DO 1 I=1,51
1     ILINE(I)=IBLK
      RETURN
C...
C...  PRINT THE TOP AND BOTTOM LINES OF THE PLOT
2     DO 3 I=1,51
3     ILINE(I)=IPER
      DO 4 I=1,51,5
4     ILINE(I)=IN
      WRITE(NO,5)(ILINE(I),I=1,51)
5     FORMAT(14X,2H..,51A1,2H..)
      RETURN
      END
