In [1]:
gem 'nyaplot', '0.1.5'
Out[1]:
In [2]:
require 'nyaplot'
Out[2]:
Out[2]:
In [3]:
include Nyaplot
Out[3]:
In [4]:
def plot_line(fname)
x_arr = []
y_arr = []
File.read(fname).split("\n").each do |str|
a, b = str.split(" ").map{|s| s.to_f}
x_arr.push(a)
y_arr.push(b)
end
p = Plot.new
p.add(:line, x_arr, y_arr)
p
end
Out[4]:
In [59]:
plot_line("/home/naoki/exp_c/compiled/36sin_with_noise.dat")
Out[59]:
In [58]:
plot_line("/home/naoki/exp_c/compiled/34sin.dat")
Out[58]:
In [67]:
plot_line("/home/naoki/exp_c/compiled/37impulse.dat")
Out[67]:
In [70]:
plot_line("/home/naoki/exp_c/compiled/37impulse5.dat")
Out[70]:
In [61]:
plot_line("/home/naoki/exp_c/compiled/38series10.dat")
Out[61]:
In [53]:
plot_line("/home/naoki/exp_c/compiled/38series100.dat")
Out[53]:
In [54]:
plot_line("/home/naoki/exp_c/compiled/38series1000.dat")
Out[54]:
In [56]:
plot_line("/home/naoki/exp_c/compiled/39error.dat")
Out[56]:
In [ ]:
{