cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
	subroutine scatplt(mxy,x1,y1,slope,int,n)
c create a scatter plot of x vs y and thier ols solution
	integer mxy,n
	real*4 x1(mxy),y1(mxy),slope,int
c	local
	integer p,j,k
	integer red,blue,green
	real*4 miny, maxy, minx, maxx
	real*4 y2(5000)
	character string*16,dev*3,filename
	logical ok,bg
c
       dev='Mac1';ok=.true.
       red=255;green=255;blue=255
       bg=.false.
c
10	if(ok)call plsdev(dev)
c
c set background color
c
      if(.not.bg)then
        call plscol0(0,255,255,255)              !change default color map black>white 
        call plscol0(15,0,0,0)                   !change default color map white>black
        call plscolbg(red,green,blue)            !change background color if other than white is desired
      elseif(bg)then
        call plscol0(15,255,255,255)              !change default color map white>black
        call plscol0(0,0,0,0)                   !change default color map black>white
        call plscolbg(red,green,blue)            !change background color if other than white is desired
      endif  
c	
	miny=9999.;maxy=-9999.
	minx=miny ;maxx=maxy
	do k=1,n
	      if(y1(k).gt.maxy)maxy=y1(k)
	      if(y1(k).lt.miny)miny=y1(k)
	      if(x1(k).gt.maxx)maxx=x1(k)
	      if(x1(k).lt.minx)minx=x1(k)
	      y2(k)=x1(k)*slope+int
	enddo
cc
c initialize plplot
	call plinit()
	call plssub(nrows,ncols)
	call plcol(15)   !color box and lables
	call plenv(minx,maxx,miny,maxy,0,2)
	call plcol(9)
	call plpoin(n,x1,y1,1)
	call plcol(1)
	call plline(n,x1,y2)
20	call plend()	    
	    
c	
       ans='C '
	dev='Mac1'
       write(*,'(/1x,''|************* plot options menu ***************|'')')
       write(*,'(1x,''|-----------------------------------------------|'')')
       write(*,'(1x,''|       [s]ave   <[c]ontinue>   [r]eplot        |'')') 
       write(*,'(1x,''|_______________________________________________|'')')
       write(*,'(/1x,'' enter option number > '',$)')
       read(*,'(a1)')ans
       if((ans.eq.'S').or.(ans.eq.'s'))then
         dev='psc';ok=.false.;filename='fig1b.ps'
	  call plsdev(dev)
         call plsfnam(filename)
         goto 10
       elseif((ans.eq.'R').or.(ans.eq.'r'))then
         ok=.true.
         goto 10
       elseif((ans.eq.'C').or.(ans.eq.'c').or.(ans.eq.' ').or.
     *                             (ans.eq.'Y').or.(ans.eq.'y'))then
         return
	endif
c
	return
	end
c
