       INCLUDE 'MISCIOFI.FOR'
       INCLUDE 'STDHDR.FOR'
       INCLUDE 'GRAFTYPE.FOR'

       INTEGER  k, i
       REAL  rr
       REAL xdata(0 : maxv), ydata(0 : maxv)
       RECORD /GroupInfoRec/ fill(0 : maxgroup)
       CHARACTER * 80  XStrings(0 : maxgroup)
       INTEGER n
       INTEGER * 2 err
       REAL y1data(0 : maxv), y2data(0 : maxv)
       REAL GroupData(0 : maxgroup, 0:maxv)

       CALL Open_Com ( 0,9600,0,1,8,48,err)
       CALL PlotterOn
      n = 20
      DO i = 0, n - 1
        CALL Random(rr)
        xdata(i) = (4.0 * pi * (rr - 0.5)) + 5.25
        ydata(i) = 25.0*(1.0/(sqrt(PI*18.0)))*
     +     exp(-(xdata(i)**2/(18.0)))
      END DO

      CALL InitSEGraphics (-1, 'c:\FOR\LIB\*.FON')

C  {  BAR GRAPH  }

      CALL SetCurrentWindow(7)
      CALL ScalePlotArea(0.0, 0.0, 10.0, 5.0)
      CALL SetAxesType(0, 0)
      CALL SelectColor(2)
      CALL AutoAxes(xdata, ydata, n, 1)
      CALL BorderCurrentWindow(2)
      CALL BarGraphData(xdata, ydata, n, 0.4, 3, 5)
      CALL DrawGrid(5)
      CALL TitleWindow('College Drinking Study')
      CALL TitleXAxis('Beers/Day')
      CALL TitleYAxis('GPA')


C     {  Scatter Data }
      CALL SetCurrentWindow(8)
      CALL ClearWindow
      CALL SelectColor(3)
      n = 20
      DO i = 0, n - 1
          Call Random(rr)
          xdata(i) = xdata(i) - 5.0
          ydata(i) = i - xdata(i) ** 2 * rr
          y1data(i) = ydata(i) - 1.0
          y2data(i) = ydata(i) + 1.0
      END DO
      CALL AutoAxes(xdata, ydata, n, 0)
      CALL BorderCurrentWindow(2)
      CALL ScatterPlotData(xdata, ydata, n, 6, 2)
      CALL SelectColor(5)
      CALL TitleWindow('Roach Study')
      CALL TitleXAxis('Radiation exposure')
      CALL TitleYAxis('Pop. 10^6')


C   { Group Demo }
      DO i =  0, 4
         DO k = 0, 4
           xdata(i) = i + 1.0
           Call Random(rr)
           GroupData(k, i) = 100.0 * rr
         END DO
      END DO
      fill(0).groupcolor = 1
      fill(1).groupcolor = 2
      fill(2).groupcolor = 3
      fill(3).groupcolor = 4
      fill(4).groupcolor = 5
      DO i = 0, 4
         fill(i).grouphatch = i + 1
      END DO
      CALL SetCurrentWindow(9)
      CALL ClearWindow
      CALL SetAxesType(0, 0)
      CALL ScalePlotArea(0.0, 0.0, 5.5, 500.0)
      CALL SetXYIntercepts(0.0, 0.0)
      XStrings(0) = 'M'
      XStrings(1) = 'T'
      XStrings(2) = 'W'
      XStrings(3) = 'Th'
      XStrings(4) = 'F'

      CALL SelectColor(1)
      CALL DrawXAxis(1.0, 0)
      CALL LabelXAxWithStrings(1, XStrings, 5, 0)
      CALL DrawYAxis(20.0, 0)
      CALL LabelYAxis(5, 0)
      CALL GroupPlotData(xdata, GroupData, 5, 5, 1,0.75, fill)
      CALL TitleWindow('Ratologist Studies')
      CALL TitleXAxis('Ratologist')
      CALL TitleYAxis('# Rats/wk.')
      CALL BorderCurrentWindow(2)


C    {  Line Plot }

      DO i = 0, 50
        xdata(i) = REAL(i)
        ydata(i) = xdata(i) ** 2
      END DO
      CALL SetCurrentWindow(10)
      CALL SetAxesType(0, 0)
      CALL SelectColor(3)
      CALL ScalePlotArea(0.0, 0.0, 20.0, 400.0)
      CALL SetXYIntercepts(0.0, 0.0)
      CALL SetLineStyleXX(0, 1)
      CALL DrawYAxis(5.0, 0)
      CALL LabelYAxis(10, 0)
      CALL DrawXAxis(0.5, 0)
      CALL LabelXAxis(10, 0)
      CALL BorderCurrentWindow(2)
      CALL LinePlotData(xdata, ydata, 50, 2, 0)
      CALL TitleWindow('Hair Growth Study')
      CALL TitleXAxis('Before/After Injections')
      CALL TitleYAxis('Hair in/wk.')

      READ (*,*)

      CALL CloseSEGraphics
      CALL Close_Com
      END

