home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / maths / pgplot_1 / Examples / f77 / PGDEMO10 < prev    next >
Text File  |  1996-05-14  |  2KB  |  77 lines

  1.       PROGRAM PGDE10
  2. C-----------------------------------------------------------------------
  3. C Demonstration program for PGPLOT. 
  4. C This program shows how the default colors can be 
  5. C overridden with PGSCRN (or PGSCR). On some devices (those with a color
  6. C lookup table), changing the background color (color index 0) takes 
  7. C effect immediately, but on others it only affects elements that are
  8. C explicitly drawn in the background color. Thus it is necessary to fill
  9. C the page with the background color, which is here done with PGERAS,
  10. C before drawing anything else (this means that PGENV cannot be used).
  11. C-----------------------------------------------------------------------
  12.       INTEGER PGBEG, I, IER
  13.       REAL XS(9),YS(9), XR(101), YR(101)
  14. C
  15. C Start a new page.
  16. C
  17.       WRITE (*,*) 'This program is intended for use with color displays'
  18.       IF (PGBEG(0,'?',1,1) .NE. 1) STOP
  19.       CALL PGPAGE
  20. C
  21. C Override default colors.
  22. C
  23.       CALL PGSCRN(0, 'DarkSlateGray', IER)
  24.       CALL PGSCRN(1, 'White', IER)
  25.       CALL PGSCRN(2, 'Yellow', IER)
  26.       CALL PGSCRN(3, 'Cyan', IER)
  27.       CALL PGSCRN(4, 'SlateGray', IER)
  28. C
  29. C "Erase" the screen to fill with background color.
  30. C
  31.       CALL PGERAS
  32. C
  33. C Set up window and viewport.
  34. C
  35.       CALL PGSCH(1.5)
  36.       CALL PGVSTD
  37.       CALL PGSWIN(0.,10.,0.,0.65)
  38. C
  39. C Fill the viewport in a different color.
  40. C
  41.       CALL PGSCI(4)
  42.       CALL PGRECT(0., 10., 0., 0.65)
  43. C
  44. C Annotation.
  45. C
  46.       CALL PGSCI(0)
  47.       CALL PGBOX('G', 0.0, 0, 'G', 0.0, 0)
  48.       CALL PGSCI(1)
  49.       CALL PGSLW(3)
  50.       CALL PGSCF(2)
  51.       CALL PGBOX('BCNST', 0.0, 0, 'BCNSTV', 0.0, 0)
  52.       CALL PGLAB('\fix', ' ', 
  53.      :           '\frPGPLOT Graph: \fi y = x\u\fr2\de\u-\fix\d')
  54. C
  55. C Plot the graph.
  56. C
  57.       DO 10 I=1,101
  58.           XR(I) = 0.1*(I-1)
  59.           YR(I) = XR(I)**2*EXP(-XR(I))
  60.  10   CONTINUE
  61.       DO 20 I=1,9
  62.           XS(I) = I
  63.           YS(I) = XS(I)**2*EXP(-XS(I))
  64.  20   CONTINUE
  65.       CALL PGSCI(2)
  66.       CALL PGSLW(4)
  67.       CALL PGLINE(101,XR,YR)
  68.       CALL PGSCI(3)
  69.       CALL PGSCH(3.0)
  70.       CALL PGPT(9,XS,YS,18)
  71. C
  72. C Done.
  73. C
  74.       CALL PGEND
  75. C
  76.       END
  77.