c
c
c***********************************************************************
c
      subroutine PLOT2 (title1,title2,xlbl,ylbl,xaray1,xaray2,yobs,yfit,
c
     2                   npts,npl,iv)
c
c-----------------------------------------------------------------------
c
c  this routine uses disspla to plot 2 curves (y and y-fit) 
c
      character*40 title2
c
      character*48  xlbl, ylbl
c
      character*57  title1
c
      logical idp,ts
c
      dimension  xaray1(npts), xaray2(npl), yobs(npts), yfit(npl)
c
      common /blkidp/ idp
      common /blkts/ ts
c
c-------------------------------------------------------------------------
c
c  find min/max values of axes
c
      xorig=xaray1(1)
      xmax=xaray1(1)
      y1orig=yobs(1)
      y1max=yobs(1) 
      yorig=yfit(1) 
      ymax=yfit(1)
      do 90 i=2,npts
         if (xaray1(i).lt.xorig) xorig=xaray1(i)
         if (xaray1(i).gt.xmax) xmax=xaray1(i)
         if (yobs(i).lt.y1orig) y1orig=yobs(i)
         if (yobs(i).gt.y1max) y1max=yobs(i)
90    continue
      if ( iv .eq. 1 ) then
                             imax = npl 
                       else
                             imax = npts
      end if
      do 100 i=2,imax
         if (yfit(i).lt.yorig) yorig=yfit(i)
         if (yfit(i).gt.ymax) ymax=yfit(i)
100   continue
      yorig=amin1(y1orig,yorig)
      ymax=amax1(y1max,ymax)
c
c  define graph dimensions... 
c
      call reset ('all')
      call basalf('standard')
      call scmplx
      call nobrdr
      call height (.2)
      call xaxang (45.)
      call yaxang (45.)
c
c  ...for tektronix screen
c
110   call page (12.5,9.5)
      if (ts) call area2d (10.,6.)
      if (.not.ts) call area2d (8.,6.)
c
c  define graph labels
c
120   call xname (xlbl,100)
      call yname (ylbl,100)
      if ( iv .eq. 1 ) then
              call headin (title1,100,-1.5,2)
              call headin (title2,100,1.,2)
                       else
              call headin ( title1,100,-1.5,3 )
              call headin ( title2,100, 1.0,3 )
              call headin ( 'observed = o , predicted = +$',
     1                       100,1.0,3 )
      end if
c
c  set up graph scale
c
      call frame
      call graf (xorig,'scale',xmax,yorig,'scale',ymax)
c
c  draw y-obs curve, then y-fit curve
c
      if ( iv .eq. 1 ) then
                             call curve (xaray1,yobs,npts,-1)
                            call curve (xaray2,yfit,npl,0)
                       else
                            call marker ( 1 )
                            call curve ( xaray1,yobs,npts,-1 )
                            call marker ( 3 )
                            call curve ( xaray2,yfit,npts,-1 )
                            call reset ('marker') 
      end if
c
c  exit
c
      call endpl (0)
c
      return
c
      end 
