Ruby(v2.0以上)にて、gnuplotライブラリを使用し、ヒートマップ(pm3d)+直線(lines)を同一グラフ上に記載したいと考えました。(OSはUbuntu 14.04)
下記ソースで出力されるサンプルを一つの画像で出力するイメージです。どのように記載すればよいでしょうか?
例)
lang
1require "gnuplot" 2#直線 3Gnuplot.open do |gp| 4 Gnuplot::Plot.new( gp ) do |plot| 5 plot.title "test plot lines" 6 plot.xlabel "x" 7 plot.ylabel "y" 8 9 plot.data << Gnuplot::DataSet.new("sin(x)") do |ds| 10 ds.with = "lines" 11 ds.linecolor = 6 12 end 13end 14 15#ヒートマップ 16Gnuplot.open do |gp| 17 Gnuplot::SPlot.new( gp ) do |plot| 18 plot.title "test plot pm3d" 19 plot.set "pm3d map" 20 plot.xlabel "x" 21 plot.ylabel "y" 22 plot.pm3d 23 plot.grid 24 25 plot.data << Gnuplot::DataSet.new("x*x + y*y") do |ds| 26 ds.with = "pm3d" 27 end 28end 29 30 31
あなたの回答
tips
プレビュー