scbi_plot 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
File without changes
@@ -1,3 +1,7 @@
1
+ === 0.0.7 2013-06-12
2
+
3
+ Added y2 axis support
4
+
1
5
  === 0.0.6 2011-06-14
2
6
 
3
7
  Check for gnuplot_executable
@@ -7,5 +7,5 @@ require 'scbi_plot/lines'
7
7
 
8
8
 
9
9
  module ScbiPlot
10
- VERSION = '0.0.6'
10
+ VERSION = '0.0.7'
11
11
  end
@@ -34,8 +34,8 @@ module ScbiPlot
34
34
 
35
35
  end
36
36
 
37
- def add_series(title, y_data, graph_type ='lines',line_width=nil)
38
- @series << {:title => title, :data=> y_data, :graph_type=>graph_type, :line_width=>(line_width || @line_width)}
37
+ def add_series(title, y_data, graph_type ='lines',line_width=nil, axes="x1y1")
38
+ @series << {:title => title, :data=> y_data, :graph_type=>graph_type, :line_width=>(line_width || @line_width), :axes=> axes}
39
39
  end
40
40
 
41
41
  def add_vertical_line(title,x_value)
@@ -62,6 +62,10 @@ module ScbiPlot
62
62
  plot.xlabel @x_label
63
63
  plot.ylabel @y_label
64
64
 
65
+ if !@y2_label.empty?
66
+ plot.y2label @y2_label
67
+ end
68
+
65
69
  if @x_range.empty?
66
70
  plot.xrange "[#{@x.min}:#{@x.max}]"
67
71
  plot.x2range "[#{@x.min}:#{@x.max}]"
@@ -73,6 +77,13 @@ module ScbiPlot
73
77
  if !@y_range.empty?
74
78
  plot.yrange @y_range
75
79
  end
80
+
81
+ if !@y2_range.empty?
82
+
83
+ plot.y2range @y2_range
84
+ plot.set 'y2tics border'
85
+ end
86
+
76
87
 
77
88
  # plot.x2range "auto"
78
89
 
@@ -104,15 +115,18 @@ module ScbiPlot
104
115
  ds.with = series[:graph_type]
105
116
  ds.linewidth = series[:line_width]
106
117
  ds.title = series[:title]
107
-
118
+ ds.axes=series[:axes]
108
119
  end
109
120
 
110
121
  end
111
-
122
+
112
123
  if !file_name.nil?
113
124
  plot.terminal "png size 800,600"
114
125
  plot.output "#{@file_name}"
115
126
  end
127
+
128
+
129
+
116
130
  end
117
131
  end
118
132
  end
@@ -22,7 +22,7 @@ module ScbiPlot
22
22
 
23
23
  class Plot
24
24
 
25
- attr_accessor :title,:file_name,:x_label,:y_label,:x_limit,:x, :y, :line_width, :x_range, :y_range
25
+ attr_accessor :title,:file_name,:x_label,:y_label,:y2_label,:x_limit,:x, :y, :line_width, :x_range, :y_range, :y2_range
26
26
 
27
27
  # Cross-platform way of finding an executable in the $PATH.
28
28
  #
@@ -48,9 +48,11 @@ module ScbiPlot
48
48
  @y=[]
49
49
  @x_label='x'
50
50
  @y_label='y'
51
+ @y2_label='y'
51
52
 
52
53
  @x_range=''
53
54
  @y_range=''
55
+ @y2_range=''
54
56
 
55
57
  @title=title
56
58
  @file_name=file_name
@@ -50,25 +50,31 @@ class TestScbiPlot < Test::Unit::TestCase
50
50
  end
51
51
 
52
52
  def test_lines
53
+ # $VERBOSE=true
53
54
  p=ScbiPlot::Lines.new('lines.png','titulo')
54
-
55
+
55
56
  x=[]
56
57
  y=[]
57
58
  y2=[]
58
59
  y3=[]
60
+
61
+ p.y2_label='second label'
59
62
 
60
63
  10.times do |i|
61
64
  x.push i*10
62
- y.push i+(rand*50).to_i
63
- y2.push i+(rand*50).to_i
64
- y3.push i+(rand*50).to_i
65
+ y.push 10 # i+(rand*50).to_i
66
+ y2.push 40 #i+(rand*50).to_i
67
+ y3.push 50 #i+(rand*50).to_i
65
68
  end
66
69
  p.x_range='[0:100]'
70
+ p.y_range='[0:70]'
71
+ p.y2_range='[0:140]'
72
+
67
73
  p.add_x(x)
68
74
  # p.add_y(y)
69
75
  p.add_series('serie0', y)
70
76
  p.add_series('serie1', y2, 'points')
71
- p.add_series('serie2', y3,'impulses',4)
77
+ p.add_series('serie2', y3,'impulses',4,"x1y2")
72
78
 
73
79
 
74
80
  p.add_vertical_line('pos',5)
metadata CHANGED
@@ -1,51 +1,91 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: scbi_plot
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.7
4
5
  prerelease:
5
- version: 0.0.6
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Dario Guerrero Fernandez
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-06-14 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2013-06-12 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
16
15
  name: gnuplot
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
23
21
  version: 2.3.0
24
22
  type: :runtime
25
- version_requirements: *id001
26
- - !ruby/object:Gem::Dependency
27
- name: hoe
28
23
  prerelease: false
29
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 2.3.0
30
+ - !ruby/object:Gem::Dependency
31
+ name: rdoc
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: '4.0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '4.0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: newgem
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: 1.5.3
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 1.5.3
62
+ - !ruby/object:Gem::Dependency
63
+ name: hoe
64
+ requirement: !ruby/object:Gem::Requirement
30
65
  none: false
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 2.8.0
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '3.6'
35
70
  type: :development
36
- version_requirements: *id002
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '3.6'
37
78
  description: scbi_plot is a simplified wrapper to create plots with gnuplot.
38
- email:
79
+ email:
39
80
  - dariogf@gmail.com
40
81
  executables: []
41
-
42
82
  extensions: []
43
-
44
- extra_rdoc_files:
83
+ extra_rdoc_files:
45
84
  - History.txt
46
85
  - Manifest.txt
47
86
  - PostInstall.txt
48
- files:
87
+ - README.rdoc
88
+ files:
49
89
  - History.txt
50
90
  - Manifest.txt
51
91
  - PostInstall.txt
@@ -60,34 +100,33 @@ files:
60
100
  - lib/scbi_plot/plot.rb
61
101
  - lib/scbi_plot/histogram.rb
62
102
  - lib/scbi_plot/lines.rb
103
+ - .gemtest
63
104
  homepage: http://www.scbi.uma.es/downloads
64
105
  licenses: []
65
-
66
106
  post_install_message:
67
- rdoc_options:
107
+ rdoc_options:
68
108
  - --main
69
109
  - README.rdoc
70
- require_paths:
110
+ require_paths:
71
111
  - lib
72
- required_ruby_version: !ruby/object:Gem::Requirement
112
+ required_ruby_version: !ruby/object:Gem::Requirement
73
113
  none: false
74
- requirements:
75
- - - ">="
76
- - !ruby/object:Gem::Version
77
- version: "0"
78
- required_rubygems_version: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
79
119
  none: false
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: "0"
120
+ requirements:
121
+ - - ! '>='
122
+ - !ruby/object:Gem::Version
123
+ version: '0'
84
124
  requirements: []
85
-
86
125
  rubyforge_project: scbi_plot
87
- rubygems_version: 1.7.2
126
+ rubygems_version: 1.8.24
88
127
  signing_key:
89
128
  specification_version: 3
90
129
  summary: scbi_plot is a simplified wrapper to create plots with gnuplot.
91
- test_files:
130
+ test_files:
92
131
  - test/test_helper.rb
93
132
  - test/test_scbi_plot.rb