scbi_plot 0.0.4 → 0.0.5
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.
- data/History.txt +4 -0
- data/lib/scbi_plot.rb +1 -1
- data/lib/scbi_plot/histogram.rb +21 -0
- data/lib/scbi_plot/lines.rb +13 -2
- data/lib/scbi_plot/plot.rb +4 -1
- data/test/test_scbi_plot.rb +2 -1
- metadata +2 -2
data/History.txt
CHANGED
data/lib/scbi_plot.rb
CHANGED
data/lib/scbi_plot/histogram.rb
CHANGED
@@ -52,6 +52,27 @@ module ScbiPlot
|
|
52
52
|
# x values are integers
|
53
53
|
if !contains_strings?(@x)
|
54
54
|
|
55
|
+
if @x_range.empty?
|
56
|
+
if @x.min==@x.max
|
57
|
+
@x.first.class
|
58
|
+
# puts "MISMO MIN MAX"
|
59
|
+
xrange="[#{@x.min-1}:#{@x.max+1}]"
|
60
|
+
else
|
61
|
+
xrange="[#{@x.min}:#{@x.max}]"
|
62
|
+
end
|
63
|
+
|
64
|
+
|
65
|
+
plot.xrange xrange
|
66
|
+
plot.x2range xrange
|
67
|
+
else
|
68
|
+
plot.xrange @x_range
|
69
|
+
plot.x2range @x_range
|
70
|
+
end
|
71
|
+
|
72
|
+
if !@y_range.empty?
|
73
|
+
plot.yrange @y_range
|
74
|
+
end
|
75
|
+
|
55
76
|
plot.style "fill pattern 22 border -1"
|
56
77
|
plot.set "boxwidth 0.2" # Probably 3-5.
|
57
78
|
|
data/lib/scbi_plot/lines.rb
CHANGED
@@ -57,8 +57,19 @@ module ScbiPlot
|
|
57
57
|
plot.title "#{@title}"
|
58
58
|
plot.xlabel @x_label
|
59
59
|
plot.ylabel @y_label
|
60
|
-
|
61
|
-
|
60
|
+
|
61
|
+
if @x_range.empty?
|
62
|
+
plot.xrange "[#{@x.min}:#{@x.max}]"
|
63
|
+
plot.x2range "[#{@x.min}:#{@x.max}]"
|
64
|
+
else
|
65
|
+
plot.xrange @x_range
|
66
|
+
plot.x2range @x_range
|
67
|
+
end
|
68
|
+
|
69
|
+
if !@y_range.empty?
|
70
|
+
plot.yrange @y_range
|
71
|
+
end
|
72
|
+
|
62
73
|
# plot.x2range "auto"
|
63
74
|
|
64
75
|
if !@show_leyend
|
data/lib/scbi_plot/plot.rb
CHANGED
@@ -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
|
25
|
+
attr_accessor :title,:file_name,:x_label,:y_label,:x_limit,:x, :y, :line_width, :x_range, :y_range
|
26
26
|
|
27
27
|
def initialize(file_name,title=nil)
|
28
28
|
|
@@ -30,6 +30,9 @@ module ScbiPlot
|
|
30
30
|
@y=[]
|
31
31
|
@x_label='x'
|
32
32
|
@y_label='y'
|
33
|
+
|
34
|
+
@x_range=''
|
35
|
+
@y_range=''
|
33
36
|
|
34
37
|
@title=title
|
35
38
|
@file_name=file_name
|
data/test/test_scbi_plot.rb
CHANGED
@@ -63,13 +63,14 @@ class TestScbiPlot < Test::Unit::TestCase
|
|
63
63
|
y2.push i+(rand*50).to_i
|
64
64
|
y3.push i+(rand*50).to_i
|
65
65
|
end
|
66
|
-
|
66
|
+
p.x_range='[0:100]'
|
67
67
|
p.add_x(x)
|
68
68
|
# p.add_y(y)
|
69
69
|
p.add_series('serie0', y)
|
70
70
|
p.add_series('serie1', y2, 'points')
|
71
71
|
p.add_series('serie2', y3,'impulses',4)
|
72
72
|
|
73
|
+
|
73
74
|
p.add_vertical_line('pos',5)
|
74
75
|
|
75
76
|
p.do_graph
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: scbi_plot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.5
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Dario Guerrero Fernandez
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-06-03 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: gnuplot
|