C******************** START FILE GAXCHK.FOR ; GROUP GAXES ******************
C==================
C  GAXCHK       GIVEN XMIN,XMAX,YMIN,YMAX OF GRAPH VIA PLOT1 COMMON,
C   CHECK THAT SPECIFIED GRAPH TYPE IS OK FOR GIVEN GRAPH LIMITS
C   AND AXIS TYPE
C  PASSED VARIABLES-- LUNTRM-- I/O CHANNEL FOR ERROR MESSAGE
C    IPTYP-- PLOT TYPE CODE (1=LINEAR, 2=SEMI-LOG (Y), ETC., AS
C       IN GAXES COMMON)
C       IF IPTYP=0 USE DEFAULT SELECTION IAXSEL IN GAXES COMMON
C
C  ICOD-- OUTPUT CODE TO PASS TO PLOT1 DPLOT1 SUBROUTINE TO GET
C   DESIRED AXIS TYPES.  MODIFIED IF ERROR CONDITION OCCURS
C
      SUBROUTINE GAXCHK(LUNTRM,IPTYP,ICOD)
C
      CHARACTER*1 ZXA1,ZYA1
C
      INCLUDE 'PLOT1MMX'
C
C  AXES COMMON
      INCLUDE 'GAXES_BLK'
C
      INCLUDE 'GSCALE_BLK'
C
      DATA ZXA1/'X'/
      DATA ZYA1/'Y'/
C
      IF(IGXINI.EQ.0) CALL GAXES0
C
      ISEL=IPTYP
      IF((ISEL.LE.0).OR.(ISEL.GT.4)) ISEL=IAXSEL
C
      IXC=IXXMAP(ISEL)
      IYC=IXYMAP(ISEL)
C
 10   CONTINUE
      IF((IXC.EQ.0).AND.(IYC.EQ.0)) GO TO 40
C
      IF(IXC.EQ.0) GO TO 20
C  CHECK X AXIS LIMITS
      IF((XMIN.LE.0.).AND.(XMAX.LE.0.)) GO TO 50
C
      IF(XMIN.LE.0.) WRITE(LUNTRM,1002) ZXA1
      IF(XMIN.LE.0) XMIN=GMINXP
C
 1002 FORMAT(' % ',A1,' LIMITS NOT SUITABLE FOR LOG PLOT'/
     >         '   STANDARD FIXUP TAKEN')
C
 20   CONTINUE
C
      IF(IYC.EQ.0) GO TO 40
C  CHECK Y-LIMITS
      IF((YMIN.LE.0.).AND.(YMAX.LE.0.)) GO TO 50
C
      IF(YMIN.LE.0.0) WRITE(LUNTRM,1002) ZYA1
      IF(YMIN.LE.0.0) YMIN=GMINYP
C
 40   CONTINUE
      ICOD=IAXCOD(ISEL)
      LOGX=IXXMAP(ISEL).eq.1
      LOGY=IXYMAP(ISEL).eq.1
      RETURN
C
C  BOTH LIMITS NEGATIVE
 50   CONTINUE
C
      WRITE(LUNTRM,1003) IAXNAM(ISEL)
 1003 FORMAT(' ? FUNCTION LIMITS NOT SUITABLE FOR ',A10,' PLOT.')
      ICOD=IAXCOD(1)
      LOGX=.FALSE.
      LOGY=.FALSE.
C
      RETURN
      	END
C******************** END FILE GAXCHK.FOR ; GROUP GAXES ******************
