numo-gnuplot 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -0
  3. data/lib/numo/gnuplot.rb +19 -2
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a5482f076a126f3270d221c2ad38455ac266b6a
4
- data.tar.gz: 1115269a4c0e558c2272f14b36e591e41d26bd28
3
+ metadata.gz: 4e865eb2bf31c1edbd04ceddc258b75df8aab368
4
+ data.tar.gz: ee119b110229d70d890b908b568aaa785fda9fbd
5
5
  SHA512:
6
- metadata.gz: 0cb38d93f404dca82818117ae8f7620c160bbd3eb3e6f3abfcf3a2d9cd44b05d2d3a445b6f2592b6011446fd7038a0da6f4660131a659c1cefb976484e0f5161
7
- data.tar.gz: 76b7602cd0fe6f0e23e5a62dddc01ff63cf5064ad54a5bf8a3d8594dfcec9d600990a81dc539c72cfc490ad0b3913220f1214ca70b94f734a4e1286b3c7a0742
6
+ metadata.gz: c31f7b733ecaa2a41cbb650338657177e781d2a42653c951999f3c2ef2f4d933eeecfe1f244369b764d183e937072687fee4a3c22ea28933dda993c3ee72a64a
7
+ data.tar.gz: 4d2b967320a263878a2db1d263bdb19cb9cdc440a2b67d72e36f127705ba69218bdab5205b3ec0ee0a9093c6bfea6ca5ffdaf288f636ed7a1ff8e297e3df3c0f
data/README.md CHANGED
@@ -28,6 +28,10 @@ Or install it yourself as:
28
28
 
29
29
  $ gem install numo-gnuplot
30
30
 
31
+ ## Demo page
32
+
33
+ * [Ruby/Numo::Gnuplot Demo](https://github.com/ruby-numo/numo-gnuplot-demo)
34
+
31
35
  ## Usage
32
36
 
33
37
  * All examples require to load Numo::Gnuplot class:
data/lib/numo/gnuplot.rb CHANGED
@@ -11,7 +11,7 @@ module Numo
11
11
 
12
12
  class Gnuplot
13
13
 
14
- VERSION = "0.1.0"
14
+ VERSION = "0.1.1"
15
15
  POOL = []
16
16
  DATA_FORMAT = "%.5g"
17
17
 
@@ -159,7 +159,7 @@ class Gnuplot
159
159
  # The `refresh` reformats and redraws the current plot using the
160
160
  # data already read in.
161
161
  def refresh
162
- send_cmd "reflesh"
162
+ send_cmd "refresh"
163
163
  nil
164
164
  end
165
165
 
@@ -172,6 +172,23 @@ class Gnuplot
172
172
  res
173
173
  end
174
174
 
175
+ KNOWN_EXT = {"ps"=>"postscript","jpg"=>"jpeg"}
176
+
177
+ # output current plot to file with terminal setting from extension
178
+ # (not Gnuplot command)
179
+ def output(filename,*opts)
180
+ if /\.(\w+)$/ =~ filename
181
+ ext = $1
182
+ ext = KNOWN_EXT[ext]||ext
183
+ set terminal:[ext,*opts], output:filename
184
+ refresh
185
+ unset :terminal, :output
186
+ else
187
+ kernel_raise GnuplotError,"file extension is not given"
188
+ end
189
+ end
190
+
191
+
175
192
  # turn on debug
176
193
  def debug_on
177
194
  @debug = true
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.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masahiro TANAKA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-22 00:00:00.000000000 Z
11
+ date: 2016-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler