      Subroutine Strlen(Strin,Len,Ideflt,Isize,Rlenth)
c
c ***********************************************************************
c *                                                                     *
c *       Subroutine Strlen - To compute the length of a string of      *
c *       text for Multiware plotting.                                  *
c *                                                                     *
c *          Programmed by Steven C. Fisher, DTNSRDC Code 1522          *
c *                                                                     *
c ***********************************************************************
c
      Byte Chrspc(95,18)
      Byte Strin(1)
      Include 'Cdefl'
c
c             Data containing the string lengths
c
      Data Chrspc/-54,-109,-54,-7,-16,21,39,-109,-72,-72,-54,39,-109,39,
     $-109,2,-16,-16,-16,-16,-16,-16,-16,-16,-16,-16,-109,-109,21,39,21,
     $-35,2,-35,-7,-7,-7,-26,-35,-7,2,-128,-54,-7,-44,21,2,2,-7,2,-7,
     $-16,-54,2,-35,21,-16,-35,-16,-72,-16,-72,2,58,-109,-26,-26,-35,
     $-26,-35,-91,-26,-26,-128,-109,-44,-128,77,-26,-26,-26,-26,-81,-44,
     $-91,-26,-54,2,-44,-54,-44,-72,-128,-72,21,-54,-100,-35,-7,-26,21,
     $30,-119,-72,-72,-54,30,-100,30,-100,12,-16,-16,-16,-16,-16,-16,
     $-16,-16,-16,-16,-100,-100,-72,30,-72,-26,2,-16,-16,-7,-7,-26,-35,
     $-7,2,-119,-44,-7,-44,21,2,2,-16,2,-16,-16,-44,2,-16,39,-16,-26,
     $-16,-72,-16,-72,2,58,-91,-16,-16,-35,-16,-35,-72,-16,-16,-119,
     $-119,-26,-119,86,-16,-26,-16,-16,-72,-44,-100,-16,-54,21,-35,-54,
     $-35,-72,-128,-72,21,-54,-109,-54,-7,-16,21,30,-109,-72,-72,-54,30,
     $-109,30,-109,12,-16,-16,-16,-16,-16,-16,-16,-16,-16,-16,-109,-109,
     $-72,30,-72,-35,2,-16,2,-7,2,-7,-16,12,21,-100,-63,2,-35,30,12,2,2,
     $2,2,-16,-26,21,-16,21,-16,-7,-16,-72,-16,-72,2,58,-109,-16,-7,-26,
     $-7,-26,-81,-26,2,-100,-100,-7,-100,105,2,-16,-7,-16,-44,-44,-63,2,
     $-35,21,-16,-26,-35,-72,-128,-72,21,-54,-100,-35,-7,-16,21,39,-100,
     $-72,-72,-54,30,-100,30,-100,12,-16,-16,-16,-16,-16,-16,-16,-16,
     $-16,-16,-100,-100,21,30,21,-26,2,-16,2,-7,2,-7,-16,12,21,-91,-54,
     $2,-35,39,21,2,2,2,2,-16,-16,21,-16,21,-16,2,-16,-72,-16,-72,2,58,
     $-100,-16,-7,-26,-7,-26,-72,-26,12,-91,-81,2,-91,114,12,-16,-7,-16,
     $-44,-44,-63,12,-35,21,-16,-26,-35,-72,-128,-72,21,-54,-100,-35,-7,
     $-7,21,39,-100,-63,-63,-44,39,-100,39,-100,2,-7,-7,-7,-7,-7,-7,-7,
     $-7,-7,-7,-100,-100,21,39,21,-7,2,-16,21,-7,12,12,2,2,39,-81,-35,
     $12,-16,49,30,2,12,2,21,12,-7,30,-16,39,2,-7,2,-72,-7,-72,2,58,
     $-100,-7,-26,-35,-7,-35,-63,-16,-7,-81,-81,-16,-91,105,12,-35,-7,
     $-16,-44,-44,-72,12,-16,67,-16,-7,-16,-72,-128,-72,21,-54,-100,-16,
     $-7,-7,21,39,-100,-54,-54,-44,30,-100,30,-100,12,-7,-7,-7,-7,-7,-7,
     $-7,-7,-7,-7,-100,-100,21,30,21,-7,2,-16,21,-7,12,12,2,2,39,-72,
     $-26,12,-16,58,30,2,12,2,21,12,2,30,-16,39,2,2,2,-72,-7,-72,-109,
     $58,-100,2,-26,-35,2,-35,-54,-7,2,-81,-81,2,-91,123,21,-16,2,-7,
     $-35,-44,-72,21,-16,77,2,2,-16,-72,-128,-72,21,-54,-100,-35,-7,-7,
     $21,39,-100,-63,-63,-44,39,-100,39,-100,2,-7,-7,-7,-7,-7,-7,-7,-7,
     $-7,-7,-100,-100,21,39,21,-7,-7,12,21,-7,12,-26,-7,2,21,-54,-44,21,
     $-35,58,12,-7,12,-7,21,-16,-35,2,-7,12,-16,2,-7,-72,-7,-72,2,58,
     $-100,-54,-72,-91,-54,-91,-119,-54,-63,-128,-128,-72,-128,30,-35,
     $-72,-63,-54,-72,-91,-128,-54,-63,-7,-54,-54,-81,-72,-128,-72,21,
     $-44,-91,-35,-7,-16,21,39,-119,-72,-72,-54,30,-91,30,-91,12,-16,
     $-16,-16,-16,-16,-16,-16,-16,-16,-16,-91,-91,21,30,21,-35,39,2,21,
     $21,12,2,12,30,21,-26,-16,21,2,58,30,39,2,39,21,12,21,21,12,49,2,
     $12,-16,-72,-16,-72,2,58,-91,-44,-35,-72,-44,-72,-81,-35,-35,-109,
     $-109,-44,-109,39,-35,-35,-35,-35,-72,-54,-109,-35,-35,39,-26,-35,
     $-35,-72,-128,-72,21,-54,30,2,-26,30,21,21,-16,-35,-35,2,30,-100,
     $30,-100,12,-16,-16,-16,-16,-16,-16,-16,-16,-16,-16,-72,39,-72,30,
     $-72,77,2,-16,2,-35,-16,-7,-16,2,21,-100,2,2,-16,30,12,2,21,2,2,-7,
     $-26,-26,2,-7,-16,12,2,-35,-16,-35,86,58,-72,12,-7,-16,-26,-35,-35,
     $-44,2,-91,-81,-16,-16,12,-16,-35,2,-26,-26,-7,-16,-16,2,2,-35,12,
     $12,-35,-128,-35,21,-49,-102,-49,-10,-23,30,30,-102,-75,-75,-49,30,
     $-102,30,-102,3,-23,-23,-23,-23,-23,-23,-23,-23,-23,-23,-102,-102,
     $30,30,30,-23,3,-23,-10,-10,-10,-23,-36,-10,3,-128,-49,-10,-49,30,
     $3,3,-10,3,-10,-23,-49,3,-23,30,-23,-23,-23,-75,-23,-75,3,56,-102,
     $-23,-23,-23,-23,-23,-89,-23,-23,-128,-102,-36,-128,82,-23,-23,-23,
     $-23,-75,-36,-89,-23,-49,3,-36,-49,-36,-75,-128,-75,30,-49,-89,-23,
     $-10,-23,30,30,-115,-75,-75,-49,30,-89,30,-89,16,-23,-23,-23,-23,
     $-23,-23,-23,-23,-23,-23,-89,-89,-75,30,-75,-23,3,-23,-23,-10,-10,
     $-23,-23,-10,3,-115,-36,-10,-36,30,3,3,-23,3,-23,-23,-36,3,-23,30,
     $-23,-23,-23,-75,-23,-75,3,56,-75,-23,-23,-23,-23,-23,-62,-23,-23,
     $-115,-115,-23,-115,82,-23,-23,-23,-23,-75,-36,-89,-23,-49,30,-23,
     $-49,-23,-75,-128,-75,30,-49,-102,-49,-10,-23,30,30,-102,-75,-75,
     $-49,30,-102,30,-102,16,-23,-23,-23,-23,-23,-23,-23,-23,-23,-23,
     $-102,-102,-75,30,-75,-23,3,-23,3,-10,3,-10,-10,16,30,-89,-62,3,
     $-23,30,16,3,3,3,3,-23,-23,30,-23,30,-23,-10,-23,-75,-23,-75,3,56,
     $-102,-10,-10,-23,-10,-23,-75,-23,3,-89,-89,-10,-89,95,3,-23,-10,
     $-23,-36,-36,-62,3,-23,30,-23,-23,-23,-75,-128,-75,30,-49,-89,-23,
     $-10,-23,30,30,-89,-75,-75,-49,30,-89,30,-89,16,-23,-23,-23,-23,
     $-23,-23,-23,-23,-23,-23,-89,-89,30,30,30,-23,3,-23,3,-10,3,-10,
     $-10,16,30,-75,-49,3,-23,30,30,3,3,3,3,-23,-23,30,-23,30,-23,3,
     $-23,-75,-23,-75,3,56,-89,-10,-10,-23,-10,-23,-75,-23,16,-75,-75,3,
     $-75,108,16,-23,-10,-23,-36,-36,-62,16,-23,30,-23,-23,-23,-75,-128,
     $-75,30,-49,-89,-23,-10,-10,30,30,-89,-62,-62,-36,30,-89,30,-89,3,
     $-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-89,-89,30,30,30,-10,3,
     $-23,30,-10,16,16,3,3,30,-75,-23,16,-23,43,30,3,16,3,30,16,-10,30,
     $-23,30,3,-10,3,-75,-10,-75,3,56,-89,-10,-23,-23,-10,-23,-62,-23,
     $-10,-75,-75,-23,-89,95,16,-23,-10,-23,-36,-36,-75,16,-23,69,-23,
     $-10,-23,-75,-128,-75,30,-49,-89,-23,-10,-10,30,30,-89,-49,-49,-36,
     $30,-89,30,-89,16,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-89,-89,
     $30,30,30,-10,3,-23,30,-10,16,16,3,3,30,-75,-23,16,-23,56,30,3,16,
     $3,30,16,3,30,-23,30,3,3,3,-75,-10,-75,-102,56,-89,3,-23,-23,3,-23,
     $-49,-10,3,-75,-75,3,-75,121,30,-23,3,-10,-23,-36,-75,30,-23,82,3,
     $3,-23,-75,-128,-75,30,-49,-89,-23,-10,-10,30,30,-89,-62,-62,-36,
     $30,-89,30,-89,3,-10,-10,-10,-10,-10,-10,-10,-10,-10,-10,-89,-89,
     $30,30,30,-10,-10,3,30,-10,16,-23,-10,3,30,-49,-36,30,-23,56,16,
     $-10,16,-10,30,-23,-23,3,-10,16,-23,3,-10,-75,-10,-75,3,56,-89,-49,
     $-62,-75,-49,-75,-102,-49,-49,-128,-128,-62,-128,30,-23,-75,-49,
     $-49,-62,-89,-128,-49,-62,-10,-49,-49,-75,-75,-128,-75,30,-36,-75,
     $-23,-10,-23,30,30,-115,-75,-75,-49,30,-75,30,-75,16,-23,-23,-23,
     $-23,-23,-23,-23,-23,-23,-23,-75,-75,30,30,30,-23,30,3,30,16,16,3,
     $16,30,30,-23,-23,30,3,56,30,30,3,30,30,16,16,30,16,43,3,16,-23,
     $-75,-23,-75,3,56,-75,-36,-23,-62,-36,-62,-75,-23,-23,-102,-102,
     $-36,-102,30,-23,-23,-23,-23,-62,-49,-102,-23,-23,30,-23,-23,-23,
     $-75,-128,-75,30,-49,30,3,-23,30,30,30,-23,-23,-23,3,30,-89,30,-89,
     $16,-23,-23,-23,-23,-23,-23,-23,-23,-23,-23,-75,30,-75,30,-75,82,3,
     $-23,3,-23,-23,-10,-23,3,30,-89,3,3,-23,30,16,3,30,3,3,-10,-23,-23,
     $3,-10,-23,16,3,-23,-23,-23,82,56,-75,16,-10,-23,-23,-23,-23,-36,3,
     $-75,-75,-23,-23,16,-23,-23,3,-23,-23,-10,-23,-23,3,3,-23,16,16,
     $-23,-128,-23,30/
c
c
      Rlenth = 0.0
      Rold   = 0.0
      Size = Isize
      If (Isize .EQ. 1) Size = 1.7
      If (Isize .EQ. 2) Size = 2.3
c
      Ichrst = Ideflt
      Iflag = 0
c
c                Main loop over the character string
c
      Do 10 I=1,Len
         If (Iflag .EQ. 1) Then
c
c                Skip this character because it is part of a control
c                sequence (fonts and super/sub settings)
c
            Iflag = 0
            Go To 10
         End If
         If (Strin(I) .EQ. 64 .AND. Len .GT. I) Then
c
c                Check for super, subscripts, and character set changes
c
            If (Strin(I+1) .EQ. '\') Then
c
c                Reset default character set
c
               If (Ichrst .GT. 9) Then
                  Ichrst = Ideflt + 9
               Else
                  Ichrst = Ideflt
               End If
            Else If (Strin(I+1) .GE. '1' .AND. Strin(I+1) .LE. '9') Then
c
c                 Change to a different character set
c
               If (Ichrst .GT. 9) Then
                  Ichrst = Strin(I+1) - 48 + 9
               Else
                  Ichrst = Strin(I+1) - 48
               End If
            Else If (Strin(I+1) .EQ. '^' .OR. Strin(I+1) .EQ. '`') Then
c
c                  Change to superscripts or subscripts
c
               If (Ichrst .LE. 9) Ichrst = Ichrst + 9
            Else If (Strin(I+1) .EQ. 64) Then
c
c                  Turn off superscripts or subscripts
c
               If (Ichrst .GT. 9) Ichrst = Ichrst - 9
            Else If (Strin(I+1) .EQ. '<') Then
c
c                  See if there are multiple lines;
c
               Rold = Amax1(Rold,Rlenth)
               Rlenth = 0.0
            Else
               Go To 5
            End If
            Iflag = 1
            Go To 10
 5          Continue
         End If
         If (Strin(I) .NE. 64 .AND. Strin(I) .GT. 31) Then
            K = Strin(I) - 31
            If (Spchar .EQ. 2 .AND. Ideflt .NE. 0) Then
               M = Chrspc(K,Ichrst)
            Else
               If (Ichrst .EQ. 9 .OR. Ichrst .LT. 8) Then
                  M = 21
               Else If (Ichrst .EQ. 8) Then
                  M = 39
               Else
                  M = -54
               End If
            End If
            If (Ichrst .LT. 10) Then
c               A = 168.*M + 33999.
               A = M + 202.4
            Else
c               A = 119.*M + 21476.
               A = 0.70834 * M + 127.834
            End If
            Rlenth = Rlenth + A!    *Size)/1000000.
         Else If (Strin(I) .EQ. 8) Then
            Rlenth = Rlenth - A!    *Size)/1000000.
         End If
 10   Continue
      Rlenth = Amax1(Rlenth,Rold)
      Rlenth = Rlenth * Size * 0.000168!     ./1000000.
      End
      Subroutine Sizplt
c
c ***********************************************************************
c *                                                                     *
c *         Subroutine  Sizplt - To size the plot maximum and           *
c *         minimum extents, to be used by PLOTFL to size and orient    *
c *         the plot so that it will fit on the plot area.              *
c *                                                                     *
c *          Programmed by Steven C. Fisher, DTNSRDC Code 1522          *
c *                                                                     *
c ***********************************************************************
c
      Include 'Cmain'
      Include 'Cplot'
      Include 'Caxis'
      Include 'Clabls'
      Include 'Ctxblk'
      Include 'Clegnd'
      Include 'Cdefl'
      Include 'Cplsiz'
c
c            Compute the size (height and width) of the plot
c
      Size = Textsz
      If (Textsz .EQ. 1) Size = 1.7
      If (Textsz .EQ. 2) Size = 2.3
      Ylmin = - 3.8 * 0.042 * Size - Axthik/2.0! - 0.042*0.1*Size
      If (Axtypx .EQ. 2) Ylmin = Ylmin - 0.9 * 0.042 * Size
      Call Axstgt(Titl,Nchrs,Xaxis,1)
      Call Supsub(Titl,Nchrs,Iup,Idown)
      Ylmin = Ylmin - (Idown * 0.4  + 0.3) * Size * 0.042
      Yhold = Ylmin
c
      If (Xnumbr .EQ. 2 .AND. Xtop .EQ. 0) Then
         Call Axstgt(Titl,Nchrs,Xaxis,2)
         Call Supsub(Titl,Nchrs,Iup,Idown)
         If (Idown .GE. 4) Iup = Iup + Idown
         Ylmax = Ylen + 4.2 * Size * 0.042 + Axthik/2.0
         If (Axtypx .EQ. 2) Ylmax = Ylmax + 0.7 * Size * 0.042
         Ylmax = Ylmax + Iup * 0.37 * Size * 0.042
      Else
         Ylmax = Ylen  + 0.015 + Axthik/2.0 + Size * 0.042/2.0
      End If
      Yhold1 = Ylmax
c
      Xlmin = -Axthik/2.0
      Xlmax = Xlen+Axthik/2.0
c
c           Add in the height and width due to the labels
c
      Do 10 I=1,Nlab
         If (Sizlab(I) .EQ. 0) Go To 10
         If (Labcrd .EQ. 0) Then
            Yo = (Ylabel(I) - Ymin(1)) * Ylen / (Ymax(1)-Ymin(1))
            Xo = (Xlabel(I) - Xmin(1)) * Xlen / (Xmax(1)-Xmin(1))
          Else
            Yo = Ylabel(I) * Ylen
            Xo = Xlabel(I) * Xlen
         End If
         Call Name(Titl,I,Label,Llabel)
         Sizes = Sizlab(I)
         Call Strlen(Titl,Llabel(I),Lachst,Sizlab(I),Rlenth)
         Call Supsub(Titl,Llabel(I),Iup,Idown)
         If (Sizlab(I) .EQ. 1) Sizes = 1.7
         If (Sizlab(I) .EQ. 2) Sizes = 2.3
         Sizes = Sizes * 0.042
c
c               Account for rotated labels
c
         If (Irot(I) .NE. 0) Then
            Angle = Irot(I)/180.*3.1415926
            Cosine = Cos(Angle)
            Sine = Sin(Angle)
            Xo = Xo - (Just(I)-1)*Rlenth*Cosine/2.0 + Sizes *
     $              (0.4 * Sine * Idown + 0.3)
            Yo = Yo - (Just(I)-1)*Rlenth*Sine/2.0 - Sizes *
     $              (0.4 * Cosine * Idown + 0.3) - 0.015
         Else
            Xo = Xo - (Just(I)-1)*Rlenth/2.0
            Yo = Yo - Sizes * (0.4 * Idown + 0.3) - 0.015
         End If
c
         Sizes = Sizes * (Idown*0.4 + Iup*0.4 + 1.3) + 0.03
         X1 = Xo
         Y1 = Yo
         If (Irot(I) .NE. 0) Then
            X2 = Xo - Sizes * Sine
            Y2 = Yo + Sizes * Cosine
            X3 = Xo + Rlenth * Cosine - Sizes * Sine
            Y3 = Yo + Rlenth * Sine + Sizes * Cosine
            X4 = Xo + Rlenth * Cosine
            Y4 = Yo + Rlenth * Sine
            Xlmin = Amin1(Xlmin,X2)
            Xlmin = Amin1(Xlmin,X3)
            Xlmin = Amin1(Xlmin,X4)
            Xlmax = Amax1(Xlmax,X1)
            Xlmax = Amax1(Xlmax,X2)
            Xlmax = Amax1(Xlmax,X4)
            Ylmin = Amin1(Ylmin,Y2)
            Ylmin = Amin1(Ylmin,Y3)
            Ylmin = Amin1(Ylmin,Y4)
            Ylmax = Amax1(Ylmax,Y1)
            Ylmax = Amax1(Ylmax,Y2)
            Ylmax = Amax1(Ylmax,Y4)
         Else
            X3 = Xo + Rlenth
            Y3 = Yo + Sizes
         End If
c
         Xlmin = Amin1(Xlmin,X1)
         Ylmin = Amin1(Ylmin,Y1)
         Xlmax = Amax1(Xlmax,X3)
         Ylmax = Amax1(Ylmax,Y3)
c
 10   Continue
c
c               Adjust for X axis text lengths (exceptionally long text)
c
      Do 20 I=1,Xnumbr
         Call Axstgt(Titl,Nchrs,Xaxis,I)
         Call Strlen(Titl,Nchrs,Axchst,Textsz,Rlenth)
         Xlmin = Amin1(Xlmin,Xlen/2.0-Rlenth/2.0)
         Xlmax = Amax1(Xlmax,Xlen/2.0+Rlenth/2.0)
 20   Continue
c
c               Adjust for Y axis text lengths (exceptionally long text)
c
      Do 30 I=1,Ynumbr
         Call Axstgt(Titl,Nchrs,Yaxis,I)
         Call Strlen(Titl,Nchrs,Axchst,Textsz,Rlenth)
         Ylmin = Amin1(Ylmin,Ylen/2.0-Rlenth/2.0)
         Ylmax = Amax1(Ylmax,Ylen/2.0+Rlenth/2.0)
 30   Continue
c
c              Get the text block lengths
c
      Do 40 I=1,Ntxbl
         If (Ntxl(I) .EQ. 0) Go To 40
         Call Yaxln(Yl,I)
         Call Xaxln(Xl,I)
         If (Labcrd .EQ. 0) Then
            Yo = (Txtbly(I) - Ymin(1)) * Ylen / (Ymax(1)-Ymin(1))
            Xo = (Txtblx(I) - Xmin(1)) * Xlen / (Xmax(1)-Xmin(1))
         Else
            Yo = Txtbly(I) * Ylen
            Xo = Txtblx(I) * Xlen
         End If
         Call Locate(X1,X2,Y1,Y2,Xl,Yl,Xo,Yo,Txbloc(I))
c
         Xlmin = Amin1(X1-Axthik/2.0,Xlmin)
         Xlmax = Amax1(X2+Axthik/2.0,Xlmax)
         Ylmin = Amin1(Y1-Axthik/2.0,Ylmin)
         Ylmax = Amax1(Y2+Axthik/2.0,Ylmax)
 40   Continue
c
c          Get the legend size
c
      If (Nleg .GT. 1 .AND. Sizleg .GT. 0) Then
         Call Legsiz(Xlv,Ylv)
c
         If (Labcrd .EQ. 0) Then
            Yo = (Yleg - Ymin(1)) * Ylen / (Ymax(1)-Ymin(1))
            Xo = (Xleg - Xmin(1)) * Xlen / (Xmax(1)-Xmin(1))
         Else
            Yo = Yleg * Ylen
            Xo = Xleg * Xlen
         End If
         Call Locate(X1,X2,Y1,Y2,Xlv,Ylv,Xo,Yo,Locleg)
c
         Xlmin = Amin1(X1-Axthik/2.0,Xlmin)
         Xlmax = Amax1(X2+Axthik/2.0,Xlmax)
         Ylmin = Amin1(Y1-Axthik/2.0,Ylmin)
         Ylmax = Amax1(Y2+Axthik/2.0,Ylmax)
      End If
c
c           Adjust for outward tickmarks
c
      If (Ticdir .EQ. 2) Then
         Ydif = Ylmax - Ylmin
         Ylmin = Amin1(Ylmin,Yhold-Ydif/78.0)
         Ylmax = Amax1(Ylmax,Yhold1+Ydif/78.0)
      End If
      Return
      End
      Subroutine Locate(X1,X2,Y1,Y2,Xlv,Ylv,Xloc,Yloc,Iflag)
c
c ***********************************************************************
c *                                                                     *
c *        Subroutine Locate - To find the corner ordinates of a box    *
c *        given the X and Y lengths, a single coordinate, and a flag   *
c *        which indicates the relative position of the box to that     *
c *        coordinate  (upper left, center, etc.).  This is used by     *
c *        the text blocks and legend.                                  *
c *                                                                     *
c *          Programmed by Steven C. Fisher, DTNSRDC Code 1522          *
c *                                                                     *
c ***********************************************************************
c
      Include 'Caxis'
      Include 'Clabls'
c
      X1 = Xloc
      Y1 = Yloc
      If (Iflag .EQ. 1) Then
         Y2 = Y1
         Y1 = Y1 - Ylv
         X2 = X1 + Xlv
      Else If (Iflag .EQ. 2) Then
         X2 = X1 + Xlv
         Y2 = Y1 + Ylv
      Else If (Iflag .EQ. 3) Then
         X2 = X1
         X1 = X2 - Xlv
         Y2 = Y1
         Y1 = Y2 - Ylv
      Else If (Iflag .EQ. 4) Then
         X2 = X1
         X1 = X2 - Xlv
         Y2 = Y1 + Ylv
      Else If (Iflag .EQ. 5) Then
         X2 = X1 + Xlv/2.0
         X1 = X2 - Xlv
         Y2 = Y1 + Ylv/2.0
         Y1 = Y2 - Ylv
      Else If (Iflag .EQ. 6) Then
         X2 = X1 + Xlv
         Y2 = Y1 + Ylv/2.0
         Y1 = Y2 - Ylv
      Else If (Iflag .EQ. 7) Then
         X2 = X1
         X1 = X2 - Xlv
         Y2 = Y1 + Ylv/2.0
         Y1 = Y2 - Ylv
      Else If (Iflag .EQ. 8) Then
         X1 = X1 - Xlv/2.0
         X2 = X1 + Xlv
         Y2 = Y1
         Y1 = Y2 - Ylv
      Else If (Iflag .EQ. 9) Then
         X1 = X1 - Xlv/2.0
         X2 = X1 + Xlv
         Y2 = Y1 + Ylv
      End If
      Return
      End
      Subroutine Axstgt(Titl,Nchrs,Axis,Nax)
c
c ***********************************************************************
c *                                                                     *
c *         Subroutine Axstgt - This subroutine finds the number of     *
c *         characters in an axis title, and copies it into a one       *
c *         dimensional byte array.                                     *
c *                                                                     *
c *            Programmed by Steven C. Fisher, DTNSRDC Code 1522        *
c *                                                                     *
c ***********************************************************************
c
      Byte Titl(1),Axis(2,80)
c
      Nchrs = 0
      Do 10 I=80,1,-1
         Titl(I) = Axis(Nax,I)
         If (Titl(I) .NE. ' ' .AND. Nchrs .EQ. 0) Nchrs = I
 10   Continue
      If (Nchrs .EQ. 0) Then
         Nchrs = 1
         Titl(1) = ' '
      End If
      Return
      End
      Subroutine Legsiz(Xsiz,Ysiz)
c
c ***********************************************************************
c *                                                                     *
c *          Subroutine Legsiz - To compute the X and Y lengths of the  *
c *          legend, in inches.  This is similar to the routine in      *
c *          PLOTFL.                                                    *
c *                                                                     *
c *            Programmed by Steven C. Fisher, DTNSRDC Code 1522        *
c *                                                                     *
c ***********************************************************************
c
      Include 'Cmain'
      Include 'Clegnd'
      Include 'Caxis'
      Include 'Cdefl'
c
      Xsiz = 0.0
      Nsp = 2
c
c            Get the labels' length, and set a flag for symbols & lines
c
      Do 30 I=2,Nleg
         Call Name(Titl,I,Lableg,Lleg)
         Call Strlen(Titl,Lleg(I),Lechst,Sizleg,Rlenth)
         Xsiz = Amax1(Xsiz,Rlenth)
         If (Symleg(I) .GT. 0 .AND. Nsp .EQ. 2) Nsp = 5
         If (Linleg(I) .GT. 0) Nsp = 12
 30   Continue
c
c              Get the title length
c
      If (Lleg(1) .GT. 0) Then
         Call Strlen(Lableg,Lleg(1),Lechst,Sizleg,Tlen)
         Numleg = Nleg
      Else
         Tlen = 0.0
         Numleg = Nleg - 1
      End If
c
c              Get the size of some spaces
c
      Call Strlen('8',1,Lechst,Sizleg,Xsp)
c
c              Select the larger of the title or labels
c
      If (Tlen .GT. Xsiz + Xsp*Nsp) Xsiz = Tlen - Xsp*Nsp
c
      Xsiz = (Xsp*(Nsp+2) + Xsiz)
      Scale = Sizleg
      If (Sizleg .EQ. 1) Scale = 1.7
      If (Sizleg .EQ. 2) Scale = 2.3
      Ysiz = 0.042 * Scale * (1.5 + Numleg*(1.0+Gblspc))
      Return
      End
      Subroutine Supsub(Strin,Len,Iup,Idown)
c
c ***********************************************************************
c *                                                                     *
c *       Subroutine Supsub - To see if the label has a superscript     *
c *       or subscript.                                                 *
c *                                                                     *
c *          Programmed by Steven C. Fisher, DTNSRDC Code 1522          *
c *                                                                     *
c ***********************************************************************
c
      Byte Strin(1)
c
      Iup = 0
      Idown = 0
      Igreek = 0
      Do 10 I=1,Len-1
         If (Strin(I) .EQ. 64) Then
            If (Strin(I+1) .EQ. '9') Igreek = 1
            If ((Strin(I+1) .GT. '0' .AND. Strin(I+1) .LT. '9')
     $               .OR. Strin(I+1) .EQ. '\') Igreek = 0
            If (Strin(I+1) .EQ. '^')  Iup = Max0(1,Iup)
            If (Strin(I+1) .EQ. '`')  Then
               If (Idown .NE. 4) Then
                  Idown = Max0(1,Idown)
               Else
                  Idown = 5
               End If
            End If
            If (Strin(I+1) .EQ. '<')  Idown = 4
         Else
            If (Igreek .EQ. 1) Then
               If (Strin(I+1) .EQ. '%' .OR. Strin(I+1) .EQ. '^' .OR.
     $             Strin(I+1) .EQ. '&' .OR. Strin(I+1) .EQ. '<' .OR.
     $             Strin(I+1) .EQ. '>' ) Iup = Max0(Iup,1)
               If (Strin(I+1) .EQ. '(' .OR.
     $             Strin(I+1) .EQ. ')' .OR. Strin(I+1) .EQ. '[' .OR.
     $             Strin(I+1) .EQ. ']' .OR. Strin(I+1) .EQ. '{' .OR.
     $             Strin(I+1) .EQ. '}' .OR. Strin(I+1) .EQ. '?') Then
                  Iup = 3
                  Idown = 3
               End If
            End If
         End If
 10   Continue
      Return
      End
      Subroutine Yaxln(Ylen,N)
c
c ***********************************************************************
c *                                                                     *
c *        Subroutine Yaxln - To determine the Y axis length of a       *
c *        text block or a viewgraph.  This uses the same type of       *
c *        methodolgy to compute the Y axis as used by PLOTFL           *
c *        to compute a text block Y extent.  This will not work right  *
c *        for hardware fonts since hardware fonts will not match       *
c *        the text size exactly.                                       *
c *                                                                     *
c *           Programmed by Steven C. Fisher, DTNSRDC Code 1522         *
c *                                                                     *
c ***********************************************************************
c
      Include 'Clabls'
      Include 'Ctxblk'
c
c          Add the height of the label plus the space above the label
c
      Ylen = 0.0
      Nbl = Nlab
      Do 10 I=1,N-1
         Nbl = Nbl + Ntxl(I)
 10   Continue
      Do 40 I=1,Ntxl(N)
         Size = Sizlab(I+Nbl)
         If (Sizlab(I+Nbl) .EQ. 1) Size = 1.7
         If (Sizlab(I+Nbl) .EQ. 2) Size = 2.3
c
c              See if we have to use the global spacing factor.
c
         If (Xlabel(I+Nbl) .GT. 0.0 .AND. I .GT. 1) Then
            Ylen = Ylen + (1.0 + Xlabel(I+Nbl)*Txblsp(N)) * Size * 0.042
         Else
            Ylen = Ylen + (1.0 + Xlabel(I+Nbl)) * Size * 0.042
         End If
         If (I .EQ. 1) Ytop = Size
         If (I .EQ. Ntxl(N)) Ybot = Size
 40   Continue
c
c          Add in the top and bottom border lengths
c
      Ylen = Ylen + 1.7 * Amax1(Ytop,Ybot) * 0.042
      Ylen = Amax1(Ylen,1.0)
      Return
      End
      Subroutine Xaxln(Xlen,N)
c
c ***********************************************************************
c *                                                                     *
c *        Subroutine Xaxln - To determine the X axis length of a       *
c *        text block or a viewgraph.  This uses the same type of       *
c *        methodolgy to compute the X axis as used by PLOTFL           *
c *        to compute a text block X extent.  This will not work right  *
c *        for hardware fonts since hardware fonts will not match       *
c *        the text size exactly.                                       *
c *                                                                     *
c *           Programmed by Steven C. Fisher, DTNSRDC Code 1522         *
c *                                                                     *
c ***********************************************************************
c
      Include 'Cmain'
      Include 'Clabls'
      Include 'Ctxblk'
c
      Xlen = 0.0
      Nbl = Nlab
      Do 10 I=1,N-1
         Nbl = Nbl + Ntxl(I)
 10   Continue
      Do 20 I=1,Ntxl(N)
         Call Name(Titl,Nbl+I,Label,Llabel)
         Idefl = Txblch(N)
         Call Strlen(Titl,Llabel(Nbl+I),Idefl,Sizlab(Nbl+I),Rlenth)
         Call Strlen('8',1,Idefl,Sizlab(Nbl+I),Alenth)
         Xlen = Amax1(Xlen,Rlenth+3.0*Alenth)
 20   Continue
      Xlen = Amax1(Xlen,3.0)
      Return
      End
