      SUBROUTINE deflim(ibin, data, imin, imax)
      INCLUDE 'xplot.inc'
      INTEGER*4 ibin, imin, imax, i
      REAL*4 data(ibin)
      REAL*4 max, min
 
      imax = 1
      imin = 1
      max = data(1)
      min = data(1)
      DO i = 2, ibin
         IF (data(i).GT.max) THEN
            imax = i
            max = data(i)
         ELSEIF (data(i).LT.min) THEN
            imin = i
            min = data(i)
         ENDIF
      ENDDO
      RETURN
      END
