R
Rob Redmon
Does anyone have an example of plotting a timeseries with gnuplot and
setting the xrange? Why doesn't the following snippet work as expected?
It produces the attached.
require 'rubygems'
require 'gnuplot'
require 'date'
obs_times = Array.new
data = Array.new
24.times { |h| obs_times << DateTime.new( 2009, 1, 1, h ); data <<
rand() }
# doesn't work either
# 24.times { |h| obs_times << "2009-1-1 #{h}:00:00"; data <<
rand() }
Gnuplot.open do |gp|
Gnuplot:lot.new( gp ) do |plot|
# causes error plot.xrange
"[\"2009-01-01T00:00:00+00:00\":\"2009-01-01T23:59:00+00:00\"]"
plot.data << Gnuplot:ataSet.new( [ obs_times, data ] ) do |ds|
ds.with = "points"
ds.linewidth = 4
end
end
end
Attachments:
http://www.ruby-forum.com/attachment/3609/Picture_1.png
setting the xrange? Why doesn't the following snippet work as expected?
It produces the attached.
require 'rubygems'
require 'gnuplot'
require 'date'
obs_times = Array.new
data = Array.new
24.times { |h| obs_times << DateTime.new( 2009, 1, 1, h ); data <<
rand() }
# doesn't work either
# 24.times { |h| obs_times << "2009-1-1 #{h}:00:00"; data <<
rand() }
Gnuplot.open do |gp|
Gnuplot:lot.new( gp ) do |plot|
# causes error plot.xrange
"[\"2009-01-01T00:00:00+00:00\":\"2009-01-01T23:59:00+00:00\"]"
plot.data << Gnuplot:ataSet.new( [ obs_times, data ] ) do |ds|
ds.with = "points"
ds.linewidth = 4
end
end
end
Attachments:
http://www.ruby-forum.com/attachment/3609/Picture_1.png