Skip to content

Instantly share code, notes, and snippets.

@komasaru
Created July 12, 2015 04:49
Show Gist options
  • Save komasaru/1395add506fd9a1a4bd6 to your computer and use it in GitHub Desktop.
Save komasaru/1395add506fd9a1a4bd6 to your computer and use it in GitHub Desktop.
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