SVG::Graph::Plot

I encountered a problem when using SVG::Graph. I have the following
code that generate a simple plot:

require ‘SVG/Graph/Plot’

This does not work.

data= [0.107,9, 0.128,1, 0.163,2, 0.188,4, 0.192,6, 0.5,5.5]

This works fine.

#data= [0.107,9, 0.128,1, 0.163,2, 0.188,4, 0.192,6, 1.5,5.5]

graph = SVG::Graph::Plot.new({
:height => 500,
:width => 800,
:key => true,
:scale_x_integers => true,
:scale_y_integerrs => true,
})

graph.add_data({
:data => data,
:title => ‘Projected’
})

f = File.new(“plot.svg”, “w+”)
f.write(graph.burn())
f.close

The error is:

123 rlaw ~/svg_graph/test > ruby plot.rb
/usr/local/lib/ruby/site_ruby/1.8/SVG/Graph/Plot.rb:206:in -': nil can't be coerced into Float (TypeError) from /usr/local/lib/ruby/site_ruby/1.8/SVG/Graph/Plot.rb:206:infield_width’
from /usr/local/lib/ruby/site_ruby/1.8/SVG/Graph/Graph.rb:522:in
draw_x_labels' from /usr/local/lib/ruby/site_ruby/1.8/SVG/Graph/Graph.rb:488:indraw_graph’
from /usr/local/lib/ruby/site_ruby/1.8/SVG/Graph/Graph.rb:203:in
`burn’
from plot.rb:19
124 rlaw ~/svg_graph/test >

Basically, when x’s are very small (i.e. smaller than 1?), I get the
above error. Is this a known bug, or am I just not using it right?

Thank you.

Ray,