Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Ruby script to draw a graph by gnuplot.(Ex.3)
#! /usr/local/bin/ruby
#-----------------------------------------------
# Ruby script to draw a graph by gnuplot.(Ex.3)
#-----------------------------------------------
require 'gnuplot'
Gnuplot.open do |gp|
Gnuplot::SPlot.new(gp) do |plot|
plot.terminal "png enhanced font 'IPA P ゴシック' fontscale 1.2"
plot.output "gnuplot_3.png"
plot.set "object 1 rect from screen 0,0 to screen 1,1 fc rgb '#D0D0E0' fillstyle solid 1.0 behind"
plot.title "作成例3"
plot.xrange "[-10:10]"
plot.yrange "[-10:10]"
plot.xlabel "x"
plot.ylabel "y"
plot.zlabel "z"
plot.pm3d
plot.grid
plot.data << Gnuplot::DataSet.new("sin(x)*cos(y)") do |ds|
ds.with = "lines"
ds.linecolor = 6
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.