C-------------------------------------------------------------------
C  GSCSMG - AUTOSCALE EVALUATION FOR MULTIPLOT DATA
C
C   USE GSCALE SUBROUTINES TO EVALUATE SCALE FOR UPCOMING 2D
C   MULTIPLOT - CF IN PARTICULAR SUBROUTINE GSCSM0
C   MODELED AFTER GSCSET WHICH WORKS FOR SIMPLE F(X) TYPE PLOTS
C
C
      SUBROUTINE GSCSMG(XDATA,YDATA,NDATAX,NDATAY,
     >     IPTRX,IINCX,IPTRY,IINCY,LPTR,NPTR)
C
C
      REAL XDATA(NDATAX),YDATA(NDATAY)
C
C   XDATA(NDATAX)  STORAGE FOR "X" DATA IN (X,Y) PAIRS
C   YDATA(NDATAY)  STORAGE FOR "Y" DATA IN (X,Y) PAIRS
C
      INTEGER IPTRX(NPTR),IPTRY(NPTR),LPTR(NPTR)
C
C   LPTR(I)  NUMBER OF (X,Y) PTS IN I'TH CONTOUR
C   IPTRX(I)  ADDRESS IN XDATA OF 1ST X PT, I'TH CONTOUR
C   IINCX     SPACING BTW. SUCCESSIVE PTS OF X DATA
C   IPTRY(I)  ADDRESS IN YDATA OF 1ST Y PT, I'TH CONTOUR
C   IINCY     SPACING BTW. SUCCESSIVE PTS OF Y DATA
C
C   FOR I = 1 TO NPTR
C
C  AXIS TYPES COMMON--
C
      INCLUDE 'GAXES_BLK'
C
C  SCALE SETTING COMMON BLOCKS --
C
      INCLUDE 'GSCALE_BLK'
C
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
C
      CALL GSCSM0(XDATA,YDATA,NDATAX,NDATAY,IPTRX,IINCX,IPTRY,IINCY,
     >     LPTR,NPTR,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 GSCSM0(XDATA,YDATA,NDATAX,NDATAY,IPTRX,IINCX,IPTRY,IINCY,
     >    LPTR,NPTR,XMIN,XMAX,1)
C
C  SET Y AXIS SCALE
C
      CALL GSCYDF(0)
C
      RETURN
      END
