Skip to content

Instantly share code, notes, and snippets.

@komasaru
Created July 12, 2015 04:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komasaru/18575f0245952cae7d02 to your computer and use it in GitHub Desktop.
Save komasaru/18575f0245952cae7d02 to your computer and use it in GitHub Desktop.
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