
      INCLUDE 'GRAFTYPE.FOR'
      INTEGER i

      REAL ContourMap(0:maxContourX,0:maxContourY)
      RECORD /GroupInfoRec/ ContourColors(0:maxLegends)
      COMMON /CM/ ContourMap

      DO i = 0, 60
        contourColors(i).groupcolor = mod(i, 15)+1
        contourColors(i).grouphatch = 0
      END DO
      CALL createFunction
      CALL InitSEGraphics(-1, 'C:\FOR\LIB\*.FON')

      CALL SetPercentWindow( 0.05,0.05, 0.95,0.80,4)
      CALL SetPercentWindow( 0.05,0.83,0.95,0.95,3)

      CALL SetCurrentWindow(4)
      CALL SetWin2PlotRatio(4, 0.15, 0.15, 0.1, 0.15 )

      CALL SetAxesType(0,0)
      CALL ScalePlotArea( -7.5, -7.5, 7.5, 7.5)
      CALL SelectColor(15)
      CALL SetXYIntercepts(-7.5,-7.5)
      CALL DrawYAxis(0.5,0)
      CALL LabelYAxis(5, 0)
      CALL DrawXAxis(0.5,0)
      CALL LabelXAxis(5,0)
      CALL SetXYIntercepts(7.5,7.5)
      CALL DrawYAxis(0.5,1)
      CALL LabelYAxis(5,1)
      CALL DrawXAxis(0.5,1)
      CALL LabelXAxis(5,1)
      CALL SetLineStyleXX(1,1)
      CALL DrawGridX(5)
      CALL DrawGridY(5)
      CALL ContourPlot(contourMap,61,61,1.0,contourColors)
      CALL BorderCurrentWindow(15)
      CALL SetCurrentWindow(3)
      CALL BorderCurrentWindow(15)
      CALL ContourPlotLegends(contourMap, 61,61,1.0,ContourColors)
      READ(*,*)
      CALL CloseSEGraphics

      END



      FUNCTION Calc3DFunction(x,y)
      REAL x, y
         Calc3DFunction = 3.0 * sin(sqrt(x*x+y*y))
      END


      SUBROUTINE CreateFunction()
      INCLUDE 'GRAFTYPE.FOR'
      REAL ContourMap(0:maxContourX,0:maxContourY)
      INTEGER i,j
      REAL x,y,z
      COMMON /CM/ ContourMap
      DO i = 0, 60
       x = REAL(i-30)/4.0
       DO j = 0, 60
         y = REAL(j-30)/4.0
         z = Calc3DFunction(x,y)
         contourMap(i,j) = z
        END DO
      END DO
      END



