gnuplot 2.3.4 → 2.3.5
Sign up to get free protection for your applications and to get access to all the features.
- data/AUTHORS.txt +3 -2
- data/ChangeLog +3 -0
- data/README.textile +18 -9
- data/Rakefile +1 -1
- data/examples/.gitignore +1 -0
- data/examples/discrete_points.rb +19 -0
- data/examples/multiple_data_sets.rb +28 -0
- data/examples/output_image_file.rb +32 -0
- data/examples/sin_wave.rb +17 -0
- metadata +14 -5
data/AUTHORS.txt
CHANGED
data/ChangeLog
CHANGED
data/README.textile
CHANGED
@@ -86,7 +86,8 @@ p. Send the Plot/Splot object to a Gnuplot instance for
|
|
86
86
|
|
87
87
|
Gnuplot.open
|
88
88
|
|
89
|
-
|
89
|
+
|
90
|
+
bq.
|
90
91
|
Instantiates a new Gnuplot process. The path to the executable is
|
91
92
|
determined on a Unix or MacOSX system using the which command. Windows
|
92
93
|
users, I have no idea what to do.
|
@@ -95,7 +96,8 @@ Gnuplot.open
|
|
95
96
|
|
96
97
|
Plot.new
|
97
98
|
|
98
|
-
|
99
|
+
|
100
|
+
SPlot.new
|
99
101
|
|
100
102
|
bq.
|
101
103
|
Create a new Plot or Splot object. DataSets are attached to the object
|
@@ -125,7 +127,8 @@ bq.
|
|
125
127
|
|
126
128
|
h2. Examples
|
127
129
|
|
128
|
-
|
130
|
+
|
131
|
+
h3. Simple sin wave
|
129
132
|
|
130
133
|
bq. The following example simply plots the value of sin(x) between the
|
131
134
|
ranges of -10 and 10. A few points to notice:
|
@@ -153,7 +156,7 @@ p. When the plot block ends, if an IO object is given to the Plot
|
|
153
156
|
Any object can be passed to the constructor as long as it
|
154
157
|
understands the << operator.
|
155
158
|
|
156
|
-
<pre
|
159
|
+
<pre>
|
157
160
|
Gnuplot.open do |gp|
|
158
161
|
Gnuplot::Plot.new( gp ) do |plot|
|
159
162
|
|
@@ -170,13 +173,16 @@ Gnuplot.open do |gp|
|
|
170
173
|
end
|
171
174
|
|
172
175
|
end
|
176
|
+
</pre>
|
173
177
|
|
174
|
-
|
178
|
+
|
179
|
+
h3. Plotting discrete points
|
175
180
|
|
176
181
|
Array data can be plotted quite easily since Arrays have a defined to_gplot method.
|
177
182
|
|
178
183
|
Simply pass an array of data to the constructor of the DataSet object or set the data property of the DataSet. In this example, because there are two arrays, each array will be a single column of data to the gnuplot process.
|
179
184
|
|
185
|
+
<pre>
|
180
186
|
Gnuplot.open do |gp|
|
181
187
|
Gnuplot::Plot.new( gp ) do |plot|
|
182
188
|
|
@@ -193,13 +199,15 @@ Gnuplot.open do |gp|
|
|
193
199
|
end
|
194
200
|
end
|
195
201
|
end
|
202
|
+
</pre>
|
196
203
|
|
197
|
-
Multiple Data Sets
|
204
|
+
h3. Multiple Data Sets
|
198
205
|
|
199
206
|
As many data sets as are desired can be attached to a plot. Each of these can have their own plot modifiers. Notice in this example how the data array is explicitly set instead of using the << operator.
|
200
207
|
|
201
208
|
Also in this example, the commands are not written to the Gnuplot process but are instead written to a File called gnuplot.dat. This file can later be run directly by a gnuplot process as it contains only the gnuplot commands.
|
202
209
|
|
210
|
+
<pre>
|
203
211
|
File.open( "gnuplot.dat", "w") do |gp|
|
204
212
|
Gnuplot::Plot.new( gp ) do |plot|
|
205
213
|
|
@@ -225,10 +233,11 @@ File.open( "gnuplot.dat", "w") do |gp|
|
|
225
233
|
]
|
226
234
|
|
227
235
|
end
|
228
|
-
|
229
236
|
end
|
230
|
-
|
237
|
+
</pre>
|
231
238
|
|
232
|
-
You can also add
|
239
|
+
You can also add arbitrary lines to the output
|
233
240
|
|
241
|
+
<pre>
|
234
242
|
plot.arbitrary_lines << "set ylabel \"y label" font \"Helvetica,20\""
|
243
|
+
</pre>
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'jeweler'
|
|
2
2
|
Jeweler::Tasks.new do |s|
|
3
3
|
s.name = 'gnuplot'
|
4
4
|
s.description = s.summary = "Utility library to aid in interacting with gnuplot"
|
5
|
-
s.version = "2.3.
|
5
|
+
s.version = "2.3.5"
|
6
6
|
s.autorequire = 'gnuplot.rb'
|
7
7
|
s.email = "rogerpack2005@gmail.com"
|
8
8
|
s.homepage = "http://github.com/rdp/ruby_gnuplot/tree/master"
|
data/examples/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
sin_wave.gif
|
@@ -0,0 +1,19 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
2
|
+
require "gnuplot"
|
3
|
+
Gnuplot.open do |gp|
|
4
|
+
Gnuplot::Plot.new( gp ) do |plot|
|
5
|
+
|
6
|
+
plot.title "Array Plot Example"
|
7
|
+
plot.ylabel "x"
|
8
|
+
plot.xlabel "x^2"
|
9
|
+
|
10
|
+
x = (0..50).collect { |v| v.to_f }
|
11
|
+
y = x.collect { |v| v ** 2 }
|
12
|
+
|
13
|
+
plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds|
|
14
|
+
ds.with = "linespoints"
|
15
|
+
ds.notitle
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
2
|
+
require "gnuplot"
|
3
|
+
Gnuplot.open do |gp|
|
4
|
+
Gnuplot::Plot.new( gp ) do |plot|
|
5
|
+
|
6
|
+
plot.xrange "[-10:10]"
|
7
|
+
plot.title "Sin Wave Example"
|
8
|
+
plot.ylabel "x"
|
9
|
+
plot.xlabel "sin(x)"
|
10
|
+
|
11
|
+
x = (0..50).collect { |v| v.to_f }
|
12
|
+
y = x.collect { |v| v ** 2 }
|
13
|
+
|
14
|
+
plot.data = [
|
15
|
+
Gnuplot::DataSet.new( "sin(x)" ) { |ds|
|
16
|
+
ds.with = "lines"
|
17
|
+
ds.title = "String function"
|
18
|
+
ds.linewidth = 4
|
19
|
+
},
|
20
|
+
|
21
|
+
Gnuplot::DataSet.new( [x, y] ) { |ds|
|
22
|
+
ds.with = "linespoints"
|
23
|
+
ds.title = "Array data"
|
24
|
+
}
|
25
|
+
]
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
2
|
+
require "gnuplot"
|
3
|
+
|
4
|
+
# See sin_wave.rb first
|
5
|
+
Gnuplot.open do |gp|
|
6
|
+
Gnuplot::Plot.new( gp ) do |plot|
|
7
|
+
|
8
|
+
# The following lines allow outputting the graph to an image file.
|
9
|
+
# The first set the kind of image that you want, while the second
|
10
|
+
# redirects the output to a given file.
|
11
|
+
#
|
12
|
+
# Typical terminals: gif, png, postscript, latex, texdraw
|
13
|
+
#
|
14
|
+
# See http://mibai.tec.u-ryukyu.ac.jp/~oshiro/Doc/gnuplot_primer/gptermcmp.html
|
15
|
+
# for a list of recognized terminals.
|
16
|
+
#
|
17
|
+
plot.terminal "gif"
|
18
|
+
plot.output File.expand_path("../sin_wave.gif", __FILE__)
|
19
|
+
|
20
|
+
# see sin_wave.rb
|
21
|
+
plot.xrange "[-10:10]"
|
22
|
+
plot.title "Sin Wave Example"
|
23
|
+
plot.ylabel "x"
|
24
|
+
plot.xlabel "sin(x)"
|
25
|
+
|
26
|
+
plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds|
|
27
|
+
ds.with = "lines"
|
28
|
+
ds.linewidth = 4
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
2
|
+
require "gnuplot"
|
3
|
+
Gnuplot.open do |gp|
|
4
|
+
Gnuplot::Plot.new( gp ) do |plot|
|
5
|
+
|
6
|
+
plot.xrange "[-10:10]"
|
7
|
+
plot.title "Sin Wave Example"
|
8
|
+
plot.ylabel "x"
|
9
|
+
plot.xlabel "sin(x)"
|
10
|
+
|
11
|
+
plot.data << Gnuplot::DataSet.new( "sin(x)" ) do |ds|
|
12
|
+
ds.with = "lines"
|
13
|
+
ds.linewidth = 4
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 2
|
7
7
|
- 3
|
8
|
-
-
|
9
|
-
version: 2.3.
|
8
|
+
- 5
|
9
|
+
version: 2.3.5
|
10
10
|
platform: ruby
|
11
11
|
authors: []
|
12
12
|
|
@@ -14,7 +14,7 @@ autorequire: gnuplot.rb
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-01-29 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies: []
|
20
20
|
|
@@ -34,6 +34,11 @@ files:
|
|
34
34
|
- LICENSE.txt
|
35
35
|
- README.textile
|
36
36
|
- Rakefile
|
37
|
+
- examples/.gitignore
|
38
|
+
- examples/discrete_points.rb
|
39
|
+
- examples/multiple_data_sets.rb
|
40
|
+
- examples/output_image_file.rb
|
41
|
+
- examples/sin_wave.rb
|
37
42
|
- lib/gnuplot.rb
|
38
43
|
- test/arrtest.rb
|
39
44
|
- test/histtest.rb
|
@@ -45,8 +50,8 @@ homepage: http://github.com/rdp/ruby_gnuplot/tree/master
|
|
45
50
|
licenses: []
|
46
51
|
|
47
52
|
post_install_message:
|
48
|
-
rdoc_options:
|
49
|
-
|
53
|
+
rdoc_options: []
|
54
|
+
|
50
55
|
require_paths:
|
51
56
|
- lib
|
52
57
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -73,6 +78,10 @@ signing_key:
|
|
73
78
|
specification_version: 3
|
74
79
|
summary: Utility library to aid in interacting with gnuplot
|
75
80
|
test_files:
|
81
|
+
- examples/discrete_points.rb
|
82
|
+
- examples/multiple_data_sets.rb
|
83
|
+
- examples/output_image_file.rb
|
84
|
+
- examples/sin_wave.rb
|
76
85
|
- test/arrtest.rb
|
77
86
|
- test/histtest.rb
|
78
87
|
- test/multtest.rb
|