C******************** START FILE GSCSET.FOR ; GROUP GSCALE ******************
C-----------------------------------------------------------
C  GSCSET    SET SCALE IN ACCORDANCE WITH CONTROLS IN
C            GSC001 COMMON
C
C  MOD DMC 2/86 - BROKEN UP INTO SUBROUTINES CF GSCMMX, GSCST0
C
      SUBROUTINE GSCSET(X,Y,Y2,I2,N)
C
C    X,Y,N   DATA TO BE GRAPHED
C    X,Y2,N   2ND SET OF DATA TO BE GRAPHED IF I2 .NE. 0
C
C       GRAPHICS BY "DPLOT1.FOR" USING DPLOT1 COMMON TO
C   CONTROL SCALE OF GRAPH
C
C  AXIS TYPES COMMON--
C
      INCLUDE 'GAXES_BLK'
C
C  SCALE SETTING COMMON BLOCKS --
C
      INCLUDE 'GSCALE_BLK'
C
C  X IN ASCENDING ORDER
      DIMENSION X(N),Y(N),Y2(N)
C
      INCLUDE 'PLOT1MMX'
C
C  START OF EXECUTABLE CODE
C
      DATA ZINFIN/1.E38/
C
C  FIND MIN/MAX OF DATA X, Y (FOR AUTOSCALING)
C
      IF(IGSINI.EQ.0) CALL GSCINI
      IF(IGXINI.EQ.0) CALL GAXES0
C
C  COMPUTE AUTOSCALE
C
      ZINFNN=-ZINFIN
      CALL GSCMMX(X,N,Y,Y2,I2,N,1,1,1,1,N,ZINFNN,ZINFIN,0)
C
C  SAVE AUTOSCALE
C
      CALL GSCSV0
C
C  SET X AXIS SCALE
C
      CALL GSCXDF(0)
C
C  IF SCALE WAS REDUCED FROM X AXIS MIN/MAX, RESET VERT AUTOSCALE
C  DATA
C
      IF((XMIN.NE.GMINX).OR.(XMAX.NE.GMAXX))
     >       CALL GSCMMX(X,N,Y,Y2,I2,N,1,1,1,1,N,XMIN,XMAX,1)
C
C  SET Y AXIS SCALE
C
      CALL GSCYDF(0)
C
      RETURN
      END
