home *** CD-ROM | disk | FTP | other *** search
/ gondwana.ecr.mu.oz.au/pub/ / Graphics.tar / Graphics / vopl.tar.Z / vopl.tar / vopl / examples / fex2.f < prev    next >
Text File  |  1989-10-04  |  2KB  |  126 lines

  1. c
  2. c    Another very simple test program for vopl.
  3. c
  4. c     This one also draws a graph of y = sin(x) 0 <= x <= 2*pi
  5. c    but shows some of the axis and range setting stuff
  6. c
  7.     program test1
  8.     parameter (pi = 3.14159265358979)
  9.     parameter (n = 300)
  10.  
  11.     real x(n), y(n)
  12.  
  13.     character device*30
  14. c
  15. c    Get VOGLE device
  16. c
  17.     write(*,'(a,$)') 'Enter VOGLE device: '
  18.     read(*,'(a)') device
  19.  
  20. c
  21. c    Generate the points
  22. c
  23.     t = 0.0
  24.     dt = 2 * pi / n
  25.  
  26.     do 10 i = 1, n
  27.         x(i) = t
  28.         y(i) = sin(t)
  29.         t = t + dt
  30. 10    continue
  31.  
  32. c
  33. c    Set the X-scaling to be absolute 0 - 10 (ie no auto-scaling)
  34. c
  35.     call range(0.0, 10.0, 'x')
  36. c
  37. c    Autoscale the Y-axis
  38. c
  39.     call adjustscale(y, n, 'y')
  40. c
  41. c    Anyone for some axis titles?
  42. c
  43.     call axistitle('This one''s for you', 'x')
  44.     call axistitle('This one''s for me', 'y')
  45. c
  46. c    As we are now about to do some graphics we initialise VOGLE
  47. c    and clear to BLACK
  48. c
  49.     call vinit(device)
  50.     call color(0)
  51.     call clear
  52. c
  53. c    Now set the color to GREEN
  54. c
  55.     call color(2)
  56.  
  57. c
  58. c    Draw the default set of axes (in GREEN)
  59. c
  60.     call drawaxes2
  61. c
  62. c    Set color to RED
  63. c
  64.     call color(1)
  65. c
  66. c    Draw the Graph
  67. c
  68.     call plot2(x, y, n)
  69. c
  70. c    Wait around a bit
  71. c
  72.     call getkey
  73. c
  74. c    Now draw a little one in the top right hand corner
  75. c    by reseting the VOGLE viewport.
  76. c
  77.     call viewport(0.0, 1.0, 0.0, 1.0)
  78. c
  79. c    Draw it again, but do the plot first (in BLUE) then the axes
  80. c    (in YELLOW)
  81. c
  82.     call color(4)
  83.     call plot2(x, y, n)
  84.     call color(3)
  85.     call drawaxes2
  86. c
  87. c    Hang around again
  88. c
  89.     call getkey
  90. c
  91. c    Clear it all away
  92. c
  93.     call color(0)
  94.     call clear
  95. c
  96. c    Reset the viewport to be a "long skinny one"
  97. c
  98.     call viewport(-1.0, 1.0, -0.5, 0.5)
  99. c
  100. c    Autoscale the X-axis again by first setting a ridicuous scale with
  101. c    range that adjustscale will change.
  102. c
  103.     call range(1000.0, -1000.0, 'x')
  104.     call adjustscale(x, n, 'x')
  105. c
  106. c    Change the X-axis title
  107. c
  108.     call axistitle('Blark Bonk Bloot', 'x')
  109. c
  110. c    And draw it all again...
  111. c
  112.     call color(5)
  113.     call drawaxes2
  114.     call color(6)
  115.     call plot2(x, y, n)
  116. c
  117. c    Hang around again
  118. c
  119.     call getkey
  120. c
  121. c    Bugger off...
  122. c
  123.  
  124.     call vexit
  125.     end
  126.