	PROGRAM SPLPLT
C
C	ROUTINE TO TEST AND DEMONSTRATE SPLSUB.FOR (SPLPLT)
C
	DIMENSION IBUF(30),X(20),Y(20)
	BYTE ANS
1	WRITE(7,5)
5	FORMAT(' ',T10,'S P L I N E  P L O T  R O U T I N E',/,
     1	' NUMBER OF DATA POINTS [4-20]? ',$)
	READ(5,6)N
6	FORMAT(I7)
	IF((N.GE.4).AND.(N.LE.20))GOTO 9
	WRITE(7,7)
7	FORMAT(' ** IMPROPER NUMBER OF DATA POINTS - RANGE 4-20 **')
	GOTO 1
9	WRITE(7,10)
10	FORMAT(' ENTER X AND Y DATA (X IN ASCENDING ORDER)::')
	WRITE(7,14)1
	READ(5,12)X(1),Y(1)
12	FORMAT(2F10.0)
	YMIN=Y(1)
	YMAX=YMIN
	DO 20 I=2,N
	WRITE(7,14)I
14	FORMAT(' data pair ',I2,':',$)
	READ(5,12)X(I),Y(I)
	IF(Y(I) .GT. YMAX)YMAX=Y(I)
	IF(Y(I) .LT. YMIN)YMIN=Y(I)
	IF(I.EQ.1)GOTO 20
	IF(X(I).GT.X(I-1))GOTO 20
	WRITE(7,15)
15	FORMAT(' ** X DATA MUST BE IN ASCENDING ORDER **')
	GOTO 9
20	CONTINUE
21	WRITE(7,22)
22	FORMAT(' WHAT WINDOW SIZE WOULD YOU LIKE FOR THE SPLINE FIT [4-20]?',$)
	READ(5,6)NUMB
	IF((NUMB.GE.4).AND.(NUMB.LE.20))GOTO 25
	WRITE(7,23)
23	FORMAT(' ** WINDOW SIZE MUST BE IN THE RANGE OF 4-20 **')
	GOTO 21
25	IF(NUMB.LE.N)GOTO 28
	WRITE(7,27)
27	FORMAT(' ** WINDOW EXCEED AMOUNT OF DATA ENTERED **')
	GOTO 21
28	WRITE(7,29)
29	FORMAT(' scaling data.......')
	XMIN=X(1)
	XMAX=X(N)
	XINC=(XMAX-XMIN)/512.
	CALL GRINIT(IBUF) !INITIALIZE BUFFER
	CALL SPLPLT(IBUF,N,X,Y,NUMB,0,YMINS,YMAXS,XINC,MODE,0)
	IF(YMAXS .GT. YMAX)YMAX=YMAXS
	IF(YMINS .LT. YMIN)YMIN=YMINS
C
C
	CALL GRREGN(IBUF,0,3) !ASSIGN BOTH GRAPHS TO
	CALL GRREGN(IBUF,1,3) !THE SAME REGION
	CALL GRSCAL(IBUF,XMIN,XMAX,YMIN,YMAX,0) !SCALE GRAPH 0
	CALL GRSCAL(IBUF,XMIN,XMAX,YMIN,YMAX,1) !SCALE GRAPH 1
	CALL GRAPHS(IBUF,1+2+4+64+128,X,Y,N,,0) !PLOT THE ACTUAL DATA
	CALL GRCLN(IBUF,1)	!CLEAR PLOT FOR GRAPH 1
C
C
	CALL SPLPLT(IBUF,N,X,Y,NUMB,1,YMINS,YMAXS,XINC,MODE,1)
	CALL VTMCUR(24,1) !POSITION CURSOR
200	CALL EXIT
	END
