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.1)
#! /usr/local/bin/ruby
#-----------------------------------------------
# Ruby script to draw a graph by gnuplot.(Ex.1)
#-----------------------------------------------
require 'gnuplot'
Gnuplot.open do |gp|
Gnuplot::Plot.new(gp) do |plot|
plot.xrange "[-10:10]"
plot.title "作成例1"
plot.xlabel "x"
plot.ylabel "y"
plot.grid
plot.data << Gnuplot::DataSet.new("sin(x)") do |ds|
ds.with = "lines"
ds.linewidth = 2
end
plot.data << Gnuplot::DataSet.new("cos(x)") do |ds|
ds.with = "lines"
ds.linewidth = 2
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.