File: pgline.html

package info (click to toggle)
ruby-pgplot 0.1.3-6
  • links: PTS, VCS
  • area: contrib
  • in suites: wheezy
  • size: 480 kB
  • sloc: ruby: 1,382; ansic: 73; makefile: 37
file content (36 lines) | stat: -rw-r--r-- 1,085 bytes parent folder | download | duplicates (2)
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
30
31
32
33
34
35
36
<?xml version="1.0" ?>
<!DOCTYPE html 
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>pgline</title>
<link href="css.css" type="text/css" rel="stylesheet" />
</head>
<body>
<h1><a name="label-0" id="label-0">Ruby/PGPLOT example: pgline</a></h1><!-- RDLabel: "Ruby/PGPLOT example: pgline" -->
<h3><a name="label-1" id="label-1">code</a></h3><!-- RDLabel: "code" -->
<pre>require 'narray'
require 'pgplot'
include Pgplot

n = 100
x = NArray.sfloat(n).indgen!/10
y = NMath.sin(x)

pgopen                 # open PGPLOT session
pgenv 0, n/10, -1, 1   # set "Plotter Environment" and draw box.
pglab "x", "y", "PGPLOT Example: y = sin(x)" 
pgsci 2                # set Color Index = Red.
pgslw 5                # set Line Width.
pgline x, y            # plot Line.</pre>
<h3><a name="label-2" id="label-2">output</a></h3><!-- RDLabel: "output" -->
<p><img src="pgline.png" alt="pgline.png"/></p>

<hr/>
<a href="./">Ruby/PGPLOT</a>
by Masahiro Tanaka


</body>
</html>