gnuplotr 0.2 → 0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/README.markdown +2 -1
  2. data/lib/gnuplotr.rb +7 -1
  3. data/test.rb +1 -0
  4. metadata +2 -2
data/README.markdown CHANGED
@@ -38,7 +38,8 @@ Here's a quick example:
38
38
  gp.set_title 'GNUPlotr example'
39
39
  gp.set_xlabel 'x', :offset => 3, :font => "Times New Roman,26"
40
40
  gp.set_ylabel "f(x)"
41
-
41
+ gp.set_xrange [0:50]
42
+
42
43
  # issue plotting commands, either with named data series
43
44
  gp.plot :parabola, "using 1:2 with points axes x1y1"
44
45
 
data/lib/gnuplotr.rb CHANGED
@@ -32,7 +32,7 @@ end
32
32
  class GNUPlotr
33
33
  attr_accessor :gnuplot_path, :series, :record
34
34
  def initialize(path=nil)
35
- @gnuplot_path = (path || '/opt/local/bin/gnuplot')
35
+ @gnuplot_path = (path || find_path)
36
36
  raise RuntimeError, "Could not find #{@gnuplot_path}" unless File.exist? @gnuplot_path
37
37
  @gnuplot, @stdout, @stderr = Open3.popen3(@gnuplot_path)
38
38
  Thread.new { capture(@stdout) {|line| puts "> " + line } }
@@ -108,6 +108,8 @@ class GNUPlotr
108
108
  t.to_s
109
109
  when String
110
110
  "'#{t}'"
111
+ when Range
112
+ "[#{t.begin}:#{t.end}]"
111
113
  when Hash
112
114
  r = ""
113
115
  t.each {|k,v|
@@ -118,6 +120,10 @@ class GNUPlotr
118
120
  t.to_s
119
121
  end
120
122
  end
123
+
124
+ def find_path
125
+ `which gnuplot`.chomp
126
+ end
121
127
  end
122
128
 
123
129
 
data/test.rb CHANGED
@@ -36,6 +36,7 @@ gp.set_grid
36
36
  gp.set_title 'GNUPlotr example'
37
37
  gp.set_xlabel 'x', :offset => 3, :font => "Times New Roman,26"
38
38
  gp.set_ylabel "f(x)"
39
+ gp.set_xrange 0..50
39
40
 
40
41
  # issue plotting commands, either with named data series
41
42
  gp.plot :parabola, "using 1:2 with points axes x1y1"
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: gnuplotr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: "0.2"
5
+ version: "0.4"
6
6
  platform: ruby
7
7
  authors:
8
8
  - Paolo Bosetti
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-24 00:00:00 -08:00
13
+ date: 2011-03-05 00:00:00 -08:00
14
14
  default_executable:
15
15
  dependencies: []
16
16