numo-gnuplot 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/README.md +16 -10
  4. data/ToDo +5 -0
  5. data/lib/numo/gnuplot.rb +6 -3
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c624c33da64f76b0b4f072f55918c6e1b5ae7a2d
4
- data.tar.gz: 8209e3093a40fcf2219cc71be057022fc329eac1
3
+ metadata.gz: 29fcfeddd9306971c509ac8bb4e90be5417fa335
4
+ data.tar.gz: 8ea65134c96a1f03de4d8eb1daee35a9a1b473a5
5
5
  SHA512:
6
- metadata.gz: eb122b78463ec953a1a9fea7a3957c4724c7ba7fed987b2c68bfa5368c85468e20ee244f75ad60ad587f13625e823ad835aa202c3916113a1832dc4340399132
7
- data.tar.gz: c0061a69f0d39943c8e2eb2d83bc2ee71429d702f87d67edecc63174d32de7ef6b7ce8c13aa6704fc58b0ad6a875858bb19361c86e7edf75847bb0689b54679b
6
+ metadata.gz: 223e5cdb0624b897309615464fc6ce32c48b350fc0a08a85207a7cfb1cfd1c04b20c4346ce19891960b238a70bb56e28762a56a1a9155aaecf008b699959341b
7
+ data.tar.gz: 8107a5596ccd6462c2c867bafc816ae57e07852d53febf8b222366c5c0d4c97727dd93bb882484eea679ca68d0c4648e63bc4af54e28625cf09c54d8ea0ddab6
data/.gitignore CHANGED
@@ -52,3 +52,5 @@ rdoc/
52
52
 
53
53
  # examples
54
54
  /examples/*.png
55
+ t
56
+ t.rb
data/README.md CHANGED
@@ -4,9 +4,9 @@ Alpha version under development.
4
4
 
5
5
  * [GitHub site](https://github.com/ruby-numo/gnuplot)
6
6
  * [RubyGems site](https://rubygems.org/gems/numo-gnuplot)
7
- * [Demo repository](https://github.com/ruby-numo/numo-gnuplot-demo)
7
+ * [Demo repository](https://github.com/ruby-numo/numo-gnuplot-demo) contains > 500 plots!
8
8
 
9
- * [API doc](http://www.rubydoc.info/gems/numo-gnuplot/Numo/Gnuplot)
9
+ * [API doc](http://www.rubydoc.info/gems/numo-gnuplot/0.2.1/Numo/Gnuplot)
10
10
  * [Introduction.ja](https://github.com/ruby-numo/gnuplot/wiki/Introduction.ja) (in Japanese)
11
11
 
12
12
  Although there are many [other Gnuplot interface libraries for Ruby](https://github.com/ruby-numo/gnuplot#related-work),
@@ -88,7 +88,7 @@ irb(gnuplot):002:0> set t:"Example Plot"
88
88
  irb(gnuplot):003:0> plot "sin(x)",w:"lines"
89
89
  ```
90
90
 
91
- * Plotting X-Y data.
91
+ * Plotting X-Y data stored in arrays.
92
92
 
93
93
  ```ruby
94
94
  require "numo/gnuplot"
@@ -102,7 +102,7 @@ Numo.gnuplot do
102
102
  end
103
103
  ```
104
104
 
105
- * Plotting X-Y data in NArray.
105
+ * Plotting X-Y data stored in NArrays.
106
106
 
107
107
  ```ruby
108
108
  require "numo/gnuplot"
@@ -129,12 +129,14 @@ x = Numo::DFloat[-n..n]/n*10
129
129
 
130
130
  Numo.gnuplot do
131
131
  set title:"multiple data series"
132
- # place next data after option Hash
132
+
133
+ # Hash-separated form
133
134
  plot x,NM.sin(x), {w:'points',t:'sin(x)'}, x,x*NM.sin(x),{w:"lines",t:'x*sin(x)'}
134
- # or place data and options in Array
135
- # plot [x,NM.sin(x), w:'points',t:'sin(x)'], [x,x*NM.sin(x),w:"lines",t:'x*sin(x)']
136
- # (here last item in each Array should be Hash in order to distinguish from array data)
137
- gets
135
+
136
+ # or Array-separated form
137
+ plot [x,NM.sin(x), w:'points',t:'sin(x)'], [x,x*NM.sin(x),w:"lines",t:'x*sin(x)']
138
+ # (here last item in each Array should be Hash, to distinguish from data array)
139
+
138
140
  end
139
141
  ```
140
142
 
@@ -218,10 +220,14 @@ See [API doc](http://www.rubydoc.info/gems/numo-gnuplot/Numo/Gnuplot) for more.
218
220
 
219
221
  ## Related Work
220
222
 
221
- * [Ruby Gnuplot](https://github.com/rdp/ruby_gnuplot/tree/master)
223
+ * [Ruby Gnuplot](https://github.com/rdp/ruby_gnuplot)
224
+ * [ruby-plot](https://github.com/davor/ruby-plot)
225
+ * [Plotrobber](https://github.com/elitheeli/plotrobber)
222
226
  * [GNUPlotr](https://github.com/pbosetti/gnuplotr)
223
227
  * [GnuPlotter](https://github.com/maasha/gnuplotter)
228
+ * [scbi_plot](https://rubygems.org/gems/scbi_plot)
224
229
  * [GnuplotRB](https://github.com/dilcom/gnuplotrb)
230
+ * [NumPlot](https://rubygems.org/gems/numplot)
225
231
 
226
232
  ## Contributing
227
233
 
data/ToDo CHANGED
@@ -1,5 +1,10 @@
1
1
  * allow rgbimage, rgbalpha -- done
2
2
  * allow timefmt data
3
3
 
4
+ * xtics array:
5
+ set xtics ("-π" -pi, "-π/2" -pi/2, 0, "π/2" pi/2, "π" pi)
6
+ * binary options:
7
+ origin=(10,10)
8
+
4
9
  * more examples
5
10
  * all style catalog
data/lib/numo/gnuplot.rb CHANGED
@@ -18,7 +18,7 @@ module Numo
18
18
 
19
19
  class Gnuplot
20
20
 
21
- VERSION = "0.2.1"
21
+ VERSION = "0.2.2"
22
22
  POOL = []
23
23
  DATA_FORMAT = "%.7g"
24
24
 
@@ -37,12 +37,12 @@ class Gnuplot
37
37
 
38
38
  def to_iruby
39
39
  require 'tempfile'
40
- tempfile_svg = Tempfile.open('plot')
40
+ tempfile_svg = Tempfile.open(['plot','.svg'])
41
41
  # output SVG to tmpfile
42
42
  gp = Gnuplot.default
43
43
  gp.reset
44
44
  gp.set terminal:'svg'
45
- gp.output:tempfile_svg.path
45
+ gp.set output:tempfile_svg.path
46
46
  gp.instance_eval(&@block)
47
47
  gp.unset 'output'
48
48
  svg = File.read(tempfile_svg.path)
@@ -290,6 +290,9 @@ class Gnuplot
290
290
  def run(s,data=nil)
291
291
  res = send_cmd(s,data)
292
292
  if !res.empty?
293
+ if /.*?End\sof\sanimation\ssequence.*?/im =~ res.to_s
294
+ return nil
295
+ end
293
296
  if res.size < 7
294
297
  if res.all?{|x| /^\s*(line \d+: )?warning:/i =~ x}
295
298
  $stderr.puts res.join.strip
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numo-gnuplot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro TANAKA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-20 00:00:00.000000000 Z
11
+ date: 2017-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler