%N vpsizcg %F $MIR/src/subs/cgpgsubs.for
%D Set encompassing viewport and subplot increment sizes
%P nebk
%: plotting
%B
      subroutine vpsizcg (dofull, dofid, ncon, gin, vin, nspec, bin,
     *  maxlev, nlevs, srtlev, levs, slev, nx, ny, pcs, xdispl,
     *  ydispb, gaps, doabut, dotr, wedcod, wedwid, tfdisp, labtyp,
     *  vxmin, vymin, vymax, vxgap, vygap, vxsize, vysize,
     *  tfvp, wdgvp)

      integer maxlev, nlevs(*), srtlev(maxlev,*), nx, ny, ncon,
     *  wedcod, nspec
      real vxmin, vymin, vymax, vxgap, vygap, vxsize, vysize, pcs,
     *  ydispb, xdispl,  wedwid, tfvp(4), tfdisp, wdgvp(4),
     *  levs(maxlev,*), slev
      logical dofid, dofull, gaps, dotr, doabut
      character*(*) gin, vin, bin, labtyp(2)*(*)
  ---------------------------------------------------------------------
  Work out view port that encompasses all sub-plots and allows
  for all labelling outside of it.   Assume unequal scales in x
  and y here.  If user wants equal scales, adjust later in VPADJCG

  Input
    dofull      True for full plot annotation (contour levels etc)
    dofid       True for interactive fiddle
    ncon        Number of contour images
    *in         Grey, vector and box type image names
    nspec       Number of spectrum images
    maxlevs     Maximum number of cintour levels per image
    nlevs       Number of contour levels for each image
    srtlev      Array to sort contours in increasing order
    levs        Contour levels for each image
    slev        Scale factor by which user given levels are scaled
                resulting in the numbers stored in levs
    nx,ny       Number of sub-plots in x and y
    pcs         PGPLOT character size for plot labels
    xdispl      Displacement of y-axis char. label from axis in char
                hghts
    ydispb      Displacement of x-axis char. label from axis in char
                hghts
    gaps        If true then don't leave gaps between sub-plots else
                leave gaps between sub-plots & label each window
    doabut      No white space at all around subplots
    dotr        Means as well as labelling plot on left and bottom
                axes, also label it at the top and right.
    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 full viewport for wedge width (wedcod=1)
    tfdisp      Displacement of transfer function plot from right
                axis in char heights
    labtyp      Axis labels
  Output
    vxmin       X-min of viewport window in normalized device coords
    vymin,vymax Y viewport range. Viewport encompasses all sub-plots
    vx,ygap     Leave a gap between sub-plots in ndc in x and y
    vx,ysize    Size of viewport of each sub-plot in ndcs in x & y
    tfvp        Viewport coords in which to draw interactive fiddle
                plot
    wdgvp       Viewport for wedge if wedcod = 1.  Other wedge type
                viewports are worked out when the wedge is drawn in
