%N ofmcol %F $MIR/src/subs/ofm.for
%D Apply a colour OFM specified by the user
%P nebk
%: pgplot, display
%B
      subroutine ofmcol (jofm, imin, imax)

      implicit none
      real imin, imax
      integer jofm

  Apply a colour lookup table as offered by the user

  Input 
    imin,max   Image min and max that PGIMAG was called with. Only
                used for iofm=5
    jofm    Type of ofm
               1 => B&W
               2 => RJS rainbow 
               3 => Tody linear pseudo colour
               4 => RDE floating zero colour contours
               5 => RDE fixed zero colour contours
               6 => RGB
               7 => Background
               8 => Heat
               9 => Absolute b&w
            If negative, then reverse
  Output in common
    iofm    Type of ofm
      include 'ofm.h'
      logical dofcc

 Do we have enough colour indices to play with ?

      if (na.eq.0) return

 Generate the table, reverse it if needed, and apply

      iofm = abs(jofm)
      call ofmtba (imin, imax, dofcc)

 If couldn't do fixed zero colour contours give b&w

      if (iofm.eq.5 .and. .not.dofcc) then
        iofm = 1
        call ofmtba (imin, imax, dofcc)
      end if
      if (jofm.lt.0) call ofmrev
      call ofmapp

      end
