Plotting y = f(x)

In this section:

The following code is extracted from program simdem09.f95 in the Simdem package, and it illustrates how easy it is to plot a curve in the form y = f(x), where x and y are double precision arrays.

! Define line and symbol types then number of points and data
      l = 1  !solid line type
      m = 5  !circle symbol type
      n = 10 !plot 10 points
      do i = 1, n
         x(i) = i
         y(i) = i
! Define title and legends
      ptitle = 'y = f(x)'
      xtitle = 'x'
      ytitle = 'y'       
c Plot the graph
      call gks001 (l, m, n, x, y, ptitle, xtitle, ytitle)

The following plot is then displayed and can be edited to add further features, printed, or archived as a graphics file.



Copyright © 1999-2021 Silverfrost Limited