home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / maths / plplot / plplot_2 / examples / f77 / x08f.f < prev    next >
Encoding:
Text File  |  1994-05-26  |  1.8 KB  |  62 lines

  1. ! $Id: x08f.f,v 1.2 1994/05/26 19:34:22 mjl Exp $
  2. ! $Log: x08f.f,v $
  3. ! Revision 1.2  1994/05/26  19:34:22  mjl
  4. ! Inserted missing CVS Id and Log fields for all Fortran demos.  Comment
  5. ! character changed to "!" everywhere, to work well with font-lock in Lucid
  6. ! emacs (requires a small change to fortran-mode.el).
  7. !
  8. !
  9.       program example08
  10. !     =================
  11. !
  12. ! Demonstration of 3-d plotting      
  13. !      
  14.       integer i,j,opt(4),npts
  15.       parameter (npts=41)
  16.  
  17.       real x(npts), y(npts), z(npts,npts)
  18.  
  19.       character*80 title(4)
  20.       real alt(4),az(4)
  21.       data opt /1,   2,   3,   3/
  22.       data alt /60.0,30.0,60.0,60.0/
  23.       data az  /30.0,60.0,120.0,160.0/
  24.       data title /'#frPLPLOT Example 8 - Alt=60, Az=30, Opt=1',
  25.      *            '#frPLPLOT Example 8 - Alt=30, Az=60, Opt=2',
  26.      *            '#frPLPLOT Example 8 - Alt=60, Az=120, Opt=3',
  27.      *            '#frPLPLOT Example 8 - Alt=60, Az=160, Opt=3'/
  28.  
  29.       do 1 i=1,npts
  30.         x(i) = (i-1-(npts/2))/real(npts/2)
  31.         y(i) = (i-1-(npts/2))/real(npts/2)
  32.     1 continue
  33.  
  34.       do 2 i=1,npts
  35.         xx = x(i)
  36.         do 3 j=1,npts
  37.           yy = y(j)
  38.           r = sqrt(xx*xx + yy*yy)
  39.           z(i,j) = exp(-r*r) * cos(2.0*3.141592654*r)
  40.     3   continue
  41.     2 continue
  42.  
  43.       call plinit()
  44.       do 5 k=1,4
  45.          call pladv(0)
  46.          call plcol(1)
  47.          call plvpor(0.0,1.0,0.0,0.9)
  48.          call plwind(-1.0,1.0,-0.9,1.1)
  49.  
  50.          call plw3d(1.0,1.0,1.0,-1.0,1.0,-1.0,1.0,-1.0,1.0,alt(k),az(k))
  51.          call plbox3('bnstu','x axis',0.0,0,'bnstu','y axis',0.0,0,
  52.      *               'bcdmnstuv','z axis',0.0,0)
  53.          call plcol(2)
  54.          call plot3d(x,y,z,npts,npts,opt(k),1,npts)
  55.          call plcol(3)
  56.          call plmtex('t',1.0,0.5,0.5,title(k))
  57.  
  58.     5 continue
  59.       call plend
  60.  
  61.       end
  62.