rubyでグラフを書きたいなって思っていたのですが,いろいろな方法はあれど,gnuplotを使えば簡単にかけるみたいですね. 方法としては, gnuplotのインストール Ruby gnuplotのパッケージのインストール だけです. 1.Gnuplotのインストール Macports経由でいすんトールするなら,ターミナルで,
require "gnuplot" Gnuplot.open do |gp| Gnuplot::Plot.new( gp ) do |plot| plot.title "Array Plot Example" plot.xlabel "x" plot.ylabel "y" plot.yrange "[0:5000]" x = (0..50).map(&:to_f) y = x.map{ |v| (v ** 2) + 3000 } x2 = (0..50).map(&:to_f) y2 = x.map{ |v| 2*v ** 2 + 2500 } plot.data << Gnuplot::DataSet.new( [x, y] ) do |ds| ds.with = "lines" ds.linewidth = 2 end plot.data << Gnuplot::DataSet.new
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く