%N wedgecg %F $MIR/src/subs/cgpgsubs.for
%D Decide if it is time to draw a wedge and do so if so
%P nebk
%: plotting
%B
      subroutine wedgecg (wedcod, wedwid, jj, trfun, groff, nbins,
     *                    cumhis, wdgvp, a1, a2)

      real groff, cumhis(*), wdgvp(4), a1, a2, wedwid
      integer wedcod, jj, nbins
      character trfun*3
  ---------------------------------------------------------------------
  Work out whether the pixel map wedges are to be drawn inside
  or outside the subplots, and whether there will be one or many

  Input
    wedcod 1 -> one wedge to right of all subplots
           2 -> one wedge to right per subplot
           3 -> one wedge per subplot inside subplot
    wedwid Fraction of subplot viewport for wedge (wedcod=2,3)
    jj     Number of subplot on this page
    trfun  Transfer function type applied to image.
    groff  Offset added to image for log and sqrt transfer functions
    nbins  Number of bins used in histogram equalization of image
    cumhis Cumulative histogram for histogram equalization returned
           by HEQCG
    wdgvp  Viewport to draw wedge in (wedcod=1)
    a1,a2  pixel map max and min
           Use the values of A1 and A2 that were sent to PGGRAY.
           These values should be those appropriate to before
           any application of transfer functions (log etc) and
           adding of offsets
    nx,ny  Number of subplots in x and y directions
    npixr  NUmber of pixel map "range" groups given by user
    trfun  Transfer function type of first "range" group
