      SUBROUTINE XAXIS(LABX,IG,IX,XL,DSPACE,INST,LOGO)
C
      COMMON /CRD/AUSX,BUSX,AUSY,BUSY,ASUX,BSUX,ASUY,BSUY,AMSX,BMSX
     1,ASMX,BSMX,AUMX,BUMX,AMUX,BMUX,DSP,ITERM,N,NS,NF
      COMMON /SCN/ XS,XF,YS,YF,XXS,XXF,YYS,YYF,CSTR,CFIN,CYMIN,CYMAX,STR
     1,FIN,YMIN,YMAX,ZZ,CW,CH,ISP,JSP,IFL
C
      BYTE LABX(8),IG,ISP,JSP,DSP,TBUF(6),IX,ITERM,IFL
      BYTE LOGO(12),BUF(30)
      DIMENSION TEMP(11)
C
C PROGRAM TO PLOT XAXIS IF IG=1 PLOTS WITH GRID LINES
C
      ENCODE(30,101,BUF) LABX,LOGO
  101 FORMAT(8A1,10X,12A1)
      IF(ISP.EQ.3.AND.IFL.GT.2) RETURN ! OVERLAY
      X3=35*CW
      CALL TPLOT(2,X3,YS)
	IF(IFL.LE.2) CALL OUTPUT(BUF,30)
      IF(ISP.GT.3) CALL OUTPUT(BUF,30)
C PLOT XAXIS
      CALL TPLOT(0,XXS,YYS)
      CALL TPLOT(1,XXF,YYS)
    3 Y1=YYS-5.
      Y2=YYS+5.
      IFLAG=1
      DX=CFIN-CSTR
      SR=0.0
      ISTR=-1
      IF(DX.LT.90.0) GO TO 100
      ISTR=CSTR
      Y=20
  115 DO 120 I=1,10
      X=I*Y
      K=DX/X
  120 IF(K.LE.9.AND.K.GT.4) GO TO 900
      Y=Y-1
      GO TO 115
  100 IF(DX.LE.4) GO TO 200
      ISTR=CSTR+0.5
      Y=10
  210 DO 220 I=1,10
      X=I*Y
      K=DX/X
  220 IF(K.LE.9.AND.K.GE.4) GO TO 900
      Y=Y-1
      IF(Y.EQ.9) Y=8
      IF(Y.EQ.7) Y=6
      GO TO 210
  200 IF(DX.LE.0.4) GO TO 300
      J=10*CSTR
      SR=FLOAT(J)/10.0
      Y=0.5
  310 DO 320 I=1,10
      X=I*Y
      K=DX/X
  320 IF(K.LE.9.AND.K.GE.4) GO TO 900
      Y=Y-0.1
      GO TO 310
  300 IF(DX.LT.0.2) GO TO 500
      J=100*CSTR
      SR=FLOAT(J)/100.0
      Y=.05
      K=DX/Y
      GO TO 900
  500 IF(DX.LE.0.09) GO TO 600
      Y=0.02
      K=DX/Y
      J=100*CSTR
      SR=FLOAT(J)/100.0
      GO TO 900
  600 Y=0.01
      K=DX/Y
      J=100*CSTR
      SR=FLOAT(J)/100.0
  900 NN=K
C
      DO 40 I=1,NN
      IF(ISTR.LT.0) GO TO 901
      D=ISTR+I*Y
      X=AUSX*D+BUSX
      IF(X.GT.XXF) GO TO 42
      GO TO 902
  901 D=SR+I*Y
      X=AUSX*D+BUSX
      IF(X.GT.XXF) GO TO 42
  902 CONTINUE
      IF(IFLAG.EQ.1.AND.IG.EQ.1)GO TO 41
      CALL TPLOT(0,X,Y1)
      CALL TPLOT(1,X,Y2)
      IFLAG=1
      GO TO 40
   41 CALL TPLOT(0,X,YYS)
      CALL TPLOT(1,X,YYF)
      IFLAG=0
   40 CONTINUE
      GO TO 43  ! NO F77
   42 NN=NN-1   ! X WAS TO LARGE ?
C
   43 IF(IG.NE.1) GO TO 30
      CALL TPLOT(0,XXS,YYS)
      CALL TPLOT(1,XXS,YYF)
   30 IF(ISP.EQ.2.AND.IFL.GT.2)RETURN ! SPLIT SCREEN
      YY=YYS-2*CW
      CALL TPLOT(2,X,YY)
C
      DO 110 I=1,NN
      IF(ISTR.LT.0) GO TO 910
      TEMP(I)=ISTR+I*Y
      GO TO 914
  910 TEMP(I)=SR+I*Y
  914 IF(IX.EQ.0) GO TO 912
      D=XL/(2.0*SIN(0.0087266*TEMP(I)))
      IF(INST.EQ.'XR') D=DSPACE*SIN(0.0087266*TEMP(I))
      ENCODE(6,17,TBUF) D
   17 FORMAT(F6.3)
      GO TO 913
  912 ENCODE(6,16,TBUF) TEMP(I)
   16 FORMAT(F6.2)
  913 X=AUSX*TEMP(I)+BUSX-4*CW
      CALL TPLOT(2,X,YY)
      CALL OUTPUT(TBUF,6)
  110 CONTINUE
C
      RETURN
      END
