irb上でふと配列とかをplotしたくなることってあると思います。 と言う訳でRubyからGnuplotにplotしてくれるRuby Gnuplotを触ってみました。 以下スクリプト(ほとんどサンプルのまま)を.irbrcでrequireされるように書いとく。 def plot(ary) require "gnuplot" Gnuplot.open do |gp| Gnuplot::Plot.new( gp ) do |plot| =begin plot.title 'title' plot.ylabel 'ylabel' plot.xlabel 'xlabel' =end x = (0..ary.length-1).collect { |v| v.to_f } y = ary plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds| ds.w
![Ruby Gnuplot を触ってみた。 - きみのハートを8ビットキャスト](https://cdn-ak-scissors.b.st-hatena.com/image/square/54a277be81c59299fae98700fb01d65ba7751b68/height=288;version=1;width=512/https%3A%2F%2Fcdn-ak.f.st-hatena.com%2Fimages%2Ffotolife%2Ft%2Ftakkaw%2F20080204%2F20080204231337.png)