      function maxbin(id)
      character*80 chtitl
      call hgive(id,chtitl,nx,xmin,xmax,ny,ymin,ymax,nwt,idb)
      w = hi(id,1)
      maxbin = 1
      do i=2,nx
         w2 = hi(id,i)
          if (w2.gt.w) then
             w = w2
             maxbin = i
          endif
       enddo
       end
