File: pgcont.rd

package info (click to toggle)
ruby-pgplot 0.1.9-3
  • links: PTS, VCS
  • area: contrib
  • in suites: buster, stretch
  • size: 604 kB
  • ctags: 144
  • sloc: ruby: 1,607; makefile: 76; ansic: 57; sh: 17
file content (29 lines) | stat: -rw-r--r-- 584 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
=begin
= Ruby/PGPLOT example: pgcont

=== code

  require "narray"
  require "pgplot"
  include Pgplot
  
  # Preparing data
  x = NArray.sfloat(40,1).indgen!(1)
  y = NArray.sfloat(1,40).indgen!(1)
  map = NMath.cos( NMath.sqrt(x*2)*0.3 - y*0.4/3 ) * NMath.cos( x*0.4/3 ) \
        + (x-y)/40
  n = 21
  level = NArray.sfloat(n).indgen! * (map.max-map.min)/n + map.min
  
  # Draw contour map
  pgopen
  pgenv(1,40,1,40)    # set "Plotter Environment" and draw box.
  pgsci(3)            # set Color Index to Green.
  pgcont  map, level

=== output

<<< pgcont.png

<<< trailer
=end